Skip to content

Commit

Permalink
merge in master
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-nicholas committed Feb 26, 2024
2 parents 4720a93 + edbac36 commit d341211
Show file tree
Hide file tree
Showing 117 changed files with 4,172 additions and 1,592 deletions.
49 changes: 37 additions & 12 deletions .github/workflows/shaka-bot-commands/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,45 @@ function start_workflow() {
gh workflow run "$WORKFLOW" -R "$THIS_REPO" "${GH_ARGS[@]}"
}

# Simple alias for converting a stream of text to lowercase.
function tolower() {
tr '[:upper:]' '[:lower:]'
}

# Outputs to global variables SHAKA_BOT_COMMAND and SHAKA_BOT_ARGUMENTS (array).
function parse_command() {
# Tokenize the comment by whitespace.
local TOKENS=( $COMMENT_BODY )

local INDEX
for (( INDEX=0; INDEX < ${#TOKENS[@]}; INDEX++ )); do
if [[ "${TOKENS[i]}" == "@shaka-bot" ]]; then
SHAKA_BOT_COMMAND="${TOKENS[i+1]}"
# A slice of all tokens starting with index i+2.
SHAKA_BOT_ARGUMENTS=( "${TOKENS[@]:i+2}" )
return 0
fi
done
echo "Parsing comment. Body: \"$COMMENT_BODY\""

# Read each line one at a time. Tokens from one line won't affect another.
local COMMENT_LINE
while read COMMENT_LINE; do
echo "Parsing comment. Line: \"$COMMENT_LINE\""

# Tokenize the line by whitespace.
local TOKENS=( $COMMENT_LINE )

local INDEX
for (( INDEX=0; INDEX < ${#TOKENS[@]}; INDEX++ )); do
if [[ "${TOKENS[INDEX]}" == "@shaka-bot" ]]; then
# The next word is the command.
SHAKA_BOT_COMMAND=$(echo "${TOKENS[INDEX+1]}" | tolower)

# Unless it's please, then it's the word after that.
if [[ "$SHAKA_BOT_COMMAND" == "please" ]]; then
INDEX=$((INDEX + 1))
SHAKA_BOT_COMMAND=$(echo "${TOKENS[INDEX+1]}" | tolower)
fi

# A slice of all tokens starting with index INDEX+2.
SHAKA_BOT_ARGUMENTS=( "${TOKENS[@]:INDEX+2}" )
return 0
fi
done
done < <(echo "$COMMENT_BODY" | tr -d '\r')
# The line above pipes COMMENT_BODY, without \r characters, into the loop.
# It is important to maintain the loop in the main shell, not a subshell, so
# that variables it writes to (SHAKA_BOT_COMMAND and SHAKA_BOT_ARGUMENTS)
# affect the caller.

return 1
}
6 changes: 4 additions & 2 deletions .github/workflows/shaka-bot-commands/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ if [[ "$SHAKA_BOT_COMMAND" == "" ]]; then
exit 0
fi

echo "PR $PR_NUMBER, detected command $SHAKA_BOT_COMMAND"
echo "PR $PR_NUMBER"
echo "Detected command \"$SHAKA_BOT_COMMAND\""
echo "Detected arguments \"$SHAKA_BOT_ARGUMENTS\""

case "$SHAKA_BOT_COMMAND" in
help) . command-help.sh ;;
test) . command-test.sh ;;
*) echo "Unknown command!" ;;
*) echo "Unknown command" ;;
esac
1 change: 1 addition & 0 deletions .github/workflows/talk-to-shaka-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
handle_command:
name: Handle Command
# Only runs on PRs that contain '@shaka-bot' comments, but not comments
# made by shaka-bot itself, who will sometimes use its own name.
# Note that contains() is not case sensitive.
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ Jonas Birmé <jonas.birme@eyevinn.se>
Jozef Chúťka <jozefchutka@gmail.com>
Jun Hong Chong <chongjunhong@gmail.com>
Jürgen Kartnaller <kartnaller@lovelysystems.com>
Justin Swaney <justin.mark.swaney@gmail.com>
JW Player <*@jwplayer.com>
Konstantin Grushetsky <github@grushetsky.net>
Lucas Gabriel Sánchez <unkiwii@gmail.com>
Martin Stark <martin.stark@eyevinn.se>
Matthias Van Parijs <matvp91@gmail.com>
Mattias Wadman <mattias.wadman@gmail.com>
Mirego <*@mirego.com>
Mohamed Rashid <ge_rashid@hotmail.co.uk>
Morten Hansen <mimo@mimo-design.com>
Nick Desaulniers <nick@mozilla.com>
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ Jozef Chúťka <jozefchutka@gmail.com>
Julian Domingo <juliandomingo@google.com>
Jun Hong Chong <chongjunhong@gmail.com>
Jürgen Kartnaller <kartnaller@lovelysystems.com>
Justin Swaney <justin.mark.swaney@gmail.com>
Konstantin Grushetsky <github@grushetsky.net>
Leandro Ribeiro Moreira <leandro.ribeiro.moreira@gmail.com>
Loïc Raux <loicraux@gmail.com>
Lucas Gabriel Sánchez <unkiwii@gmail.com>
Martin Stark <martin.stark@eyevinn.se>
Matias Russitto <russitto@gmail.com>
Mathieu Côté <mcote@mirego.com>
Matthias Van Parijs <matvp91@gmail.com>
Mattias Wadman <mattias.wadman@gmail.com>
Michelle Zhuo <michellezhuo@google.com>
Expand Down
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,30 @@ 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.

-----

Contains code from https://github.com/TobiasNickel/tXml
(See lib/util/tXml.js)

tXml MIT License Agreement

Copyright 2015 Tobias Nickel

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.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ for the up-to-date list of maintained branches of Shaka Player.
|Chromecast². | - | - | - | - | - | - | - | - |**Y**|
|Tizen TV³ | - | - | - | - | - | - | - | - |**Y**|
|WebOS⁶ | - | - | - | - | - | - | - | - |**Y**|
|Hisense⁷ | - | - | - | - | - | - | - | - |**Y**|
|Xbox One | - | - | - | - | - | - | - | - |**Y**|
|Playstation 4⁷| - | - | - | - | - | - | - | - |**Y**|
|Playstation 5⁷| - | - | - | - | - | - | - | - |**Y**|
Expand Down Expand Up @@ -168,18 +169,19 @@ MSS features **not** supported:

## DRM support matrix

|Browser |Widevine |PlayReady|FairPlay |ClearKey⁶ |
|:--------:|:--------:|:-------:|:-------:|:--------:|
|Chrome¹ |**Y** | - | - |**Y** |
|Firefox² |**Y** | - | - |**Y** |
|Edge³ | - |**Y** | - | - |
|Edge Chromium|**Y** |**Y** | - |**Y** |
|Safari | - | - |**Y** | - |
|Opera |untested⁵ | - | - |untested⁵ |
|Chromecast|**Y** |**Y** | - |untested⁵ |
|Tizen TV |**Y** |**Y** | - |untested⁵ |
|WebOS⁷ |untested⁷ |untested⁷| - |untested⁷ |
|Xbox One | - |**Y** | - | - |
|Browser |Widevine |PlayReady|FairPlay |ClearKey⁶ |
|:------------:|:--------:|:-------:|:-------:|:--------:|
|Chrome¹ |**Y** | - | - |**Y** |
|Firefox² |**Y** | - | - |**Y** |
|Edge³ | - |**Y** | - | - |
|Edge Chromium |**Y** |**Y** | - |**Y** |
|Safari | - | - |**Y** | - |
|Opera |untested⁵ | - | - |untested⁵ |
|Chromecast |**Y** |**Y** | - |untested⁵ |
|Tizen TV |**Y** |**Y** | - |untested⁵ |
|WebOS⁷ |untested⁷ |untested⁷| - |untested⁷ |
|Hisense⁷ |untested⁷ |untested⁷| - |untested⁷ |
|Xbox One | - |**Y** | - | - |
|Playstation 4⁷| - |untested⁷| - |untested⁷ |
|Playstation 5⁷| - |untested⁷| - |untested⁷ |

Expand Down Expand Up @@ -208,7 +210,7 @@ NOTES:
NOTES:
- ¹: By default, FairPlay is handled using Apple's native HLS player, when on
Safari. We do support FairPlay through MSE/EME, however. See the
`streaming.useNativeHlsOnSafari` configuration value.
`streaming.useNativeHlsForFairPlay` configuration value.


## Media container and subtitle support
Expand Down
33 changes: 33 additions & 0 deletions build/shaka-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ vars:
media.gmp-manager.updateEnabled: true
# Overrides Firefox's Linux-specific default setting to disable DRM.
media.eme.enabled: true
# Disable GPU acceleration to avoid contention for hardware resources
# during parallel testing and to create more stability for screenshots.
media.hardware-video-decoding.enabled: false
media.hardware-video-decoding.force-enabled: false

basic_chrome_config: &basic_chrome_config
goog:chromeOptions:
Expand All @@ -37,6 +41,9 @@ vars:
- "--disable-background-media-suspend"
- "--disable-background-timer-throttling"
- "--disable-backgrounding-occluded-windows"
# Disable GPU acceleration to avoid contention for hardware resources
# during parallel testing and to create more stability for screenshots.
- "--disable-gpu"

# Instruct chromedriver not to disable component updater. The component
# updater must run in order for the Widevine CDM to be available when
Expand All @@ -55,6 +62,9 @@ vars:
- "--disable-background-media-suspend"
- "--disable-background-timer-throttling"
- "--disable-backgrounding-occluded-windows"
# Disable GPU acceleration to avoid contention for hardware resources
# during parallel testing and to create more stability for screenshots.
- "--disable-gpu"

# Instruct edgedriver not to disable component updater. The component
# updater must run in order for the Widevine CDM to be available when
Expand All @@ -68,6 +78,18 @@ vars:
ms:edgeOptions:
binary: /usr/bin/microsoft-edge

# Work around https://github.com/MicrosoftEdge/EdgeWebDriver/issues/102#issuecomment-1710724173
# by specifying the binary path on Mac.
edge_mac_config: &edge_mac_config
ms:edgeOptions:
binary: /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge

# Work around https://github.com/MicrosoftEdge/EdgeWebDriver/issues/102#issuecomment-1710724173
# by specifying the binary path on Mac.
edge_windows_config: &edge_windows_config
ms:edgeOptions:
binary: "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"

android_chrome_config: &android_chrome_config
goog:chromeOptions:
args:
Expand All @@ -76,6 +98,12 @@ vars:
# --unsafely-allow... does not work.
- "--user-data-dir=/data/data/com.android.chrome/cache"

excludeSwitches:
# On Android, we must override the --disable-gpu set in the general
# Chrome settings. This flag is not supported on Android, where GPU is
# required.
- "disable-gpu"

# Once the new session request reaches chromedriver, it will take
# the androidPackage option as a request to start Chrome through
# adb on the tethered device.
Expand Down Expand Up @@ -107,6 +135,9 @@ vars:
- "--disable-background-media-suspend"
- "--disable-background-timer-throttling"
- "--disable-backgrounding-occluded-windows"
# Disable GPU acceleration to avoid contention for hardware resources
# during parallel testing and to create more stability for screenshots.
- "--disable-gpu"

safari_tp_config: &safari_tp_config
safari.options:
Expand All @@ -132,6 +163,7 @@ EdgeMac:
os: Mac
extra_configs:
- *basic_edge_config
- *edge_mac_config

Safari:
browser: safari
Expand Down Expand Up @@ -165,6 +197,7 @@ Edge:
os: Windows
extra_configs:
- *basic_edge_config
- *edge_windows_config


### Linux ###
Expand Down
2 changes: 2 additions & 0 deletions build/types/core
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
+../../lib/media/content_workarounds.js
+../../lib/media/drm_engine.js
+../../lib/media/gap_jumping_controller.js
+../../lib/media/manifest_filterer.js
+../../lib/media/manifest_parser.js
+../../lib/media/media_source_capabilities.js
+../../lib/media/media_source_engine.js
+../../lib/media/mp4_segment_index_parser.js
+../../lib/media/play_rate_controller.js
+../../lib/media/playhead.js
+../../lib/media/playhead_observer.js
+../../lib/media/preload_manager.js
+../../lib/media/presentation_timeline.js
+../../lib/media/quality_observer.js
+../../lib/media/region_observer.js
Expand Down
51 changes: 51 additions & 0 deletions demo/asset_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,57 @@ shakaDemo.AssetCard = class {
this.remakeButtonsFn_(this);
}

/** Adds basic buttons to the card ("play" and "preload"). */
addBaseButtons() {
let disableButtons = false;
this.addButton('Play', async () => {
if (disableButtons) {
return;
}
disableButtons = true;
await shakaDemoMain.loadAsset(this.asset_);
this.remakeButtons();
});
let preloadName = 'Start Preload';
if (this.asset_.preloadManager) {
preloadName = this.asset_.preloaded ? 'Preloaded!' : 'Preloading...';
} else if (this.asset_.preloadFailed) {
preloadName = 'Failed to Preload!';
}
const preloadButton = this.addButton(preloadName, async () => {
if (disableButtons) {
return;
}
disableButtons = true;
this.asset_.preloaded = false;
if (this.asset_.preloadManager) {
await this.asset_.preloadManager.destroy();
this.asset_.preloadManager = null;
this.remakeButtons();
} else {
try {
await shakaDemoMain.preloadAsset(this.asset_);
this.remakeButtons();
if (this.asset_.preloadManager) {
await this.asset_.preloadManager.waitForFinish();
this.asset_.preloaded = true;
} else {
this.asset_.preloadFailed = true;
}
} catch (error) {
this.asset_.preloadManager = null;
this.asset_.preloadFailed = true;
throw error;
} finally {
this.remakeButtons();
}
}
});
if (this.asset_.preloadFailed) {
preloadButton.disabled = true;
}
}

/**
* Adds a button to the bottom of the card that controls storage behavior.
* This is a separate function because it involves a significant amount of
Expand Down
12 changes: 12 additions & 0 deletions demo/common/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ const ShakaDemoAssetInfo = class {
this.mimeType = null;


// Preload values.
/** @type {?shaka.media.PreloadManager} */
this.preloadManager;
this.preloaded = false;
this.preloadFailed = false;


// Offline storage values.
/** @type {?function()} */
this.storeCallback;
Expand Down Expand Up @@ -399,6 +406,11 @@ const ShakaDemoAssetInfo = class {
// proper formatting.
const raw = {};
for (const key in this) {
if (key.startsWith('preload') || key.startsWith('store') ||
key.endsWith('Callback')) {
// These values shouldn't be saved, as they are dynamic.
continue;
}
const value = this[key];
if (value instanceof Map) {
// The built-in JSON functions cannot convert Maps; this converts Maps
Expand Down

0 comments on commit d341211

Please sign in to comment.