From a613c54f7cf4a5d6651df2e8a05ed017daeb3035 Mon Sep 17 00:00:00 2001 From: Daniel Weinberger Date: Tue, 2 Jul 2024 10:47:22 +0200 Subject: [PATCH] Add static build for "generic" TV apps --- .gitignore | 2 ++ generic-tv/README.md | 13 +++++++++++++ generic-tv/platformSpecificInit.js | 21 +++++++++++++++++++++ package.json | 6 ++++-- web/README.md | 2 +- 5 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 generic-tv/README.md create mode 100644 generic-tv/platformSpecificInit.js diff --git a/.gitignore b/.gitignore index 67c962f..5120fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ tizen/index.html tizen/js/*.js WebOS/index.html WebOS/js/*.js +generic-tv/index.html +generic-tv/js/*.js diff --git a/generic-tv/README.md b/generic-tv/README.md new file mode 100644 index 0000000..5218756 --- /dev/null +++ b/generic-tv/README.md @@ -0,0 +1,13 @@ +# Bitmovin Player Yospace Integration Generic TV Sample + +This folder contains a sample for how to use the Bitmovin Player Yospace Integration library on web-based TVs. + +For Samsung Tizen or LG WebOS TVs, please refer to the specific respective examples, [../tizen/](../tizen/) and [../WebOS/](../WebOS/). + +## Getting started + +Run `npm run build-tv` (or `npm run build-tv:dev`) in the project root to build the library and copy all required files, including the sample web page and Javascript files, to the correct location in this folder. + +Deploy the content of this folder, including subdirectories, to a web server and point your TV app to this. Exact details may vary depending on the TV platform. + +Please note that changes in the `index.html` and `js/*` files will be overwritten by the build tooling, changes should be made in the [../web/\*](../web/) folder only. diff --git a/generic-tv/platformSpecificInit.js b/generic-tv/platformSpecificInit.js new file mode 100644 index 0000000..3485981 --- /dev/null +++ b/generic-tv/platformSpecificInit.js @@ -0,0 +1,21 @@ +var platformReadyForPlayerPromise = (function () { + return Promise.resolve(); +})(); + +function updateWithPlatformSpecificConfig(config) { + config.tweaks = config.adaptation || {}; + config.tweaks.maxStartupBitrate = '1.0mbps'; + return config; +} + +function updateWithPlatformSpecificSourceConfig(source) { + if (source.drm && source.drm.playready) { + source.drm.playready.utf8message = true; + source.drm.playready.plaintextChallenge = true; + source.drm.playready.headers = source.drm.playready.headers || {}; + source.drm.playready.headers['Content-Type'] = 'text/xml'; + } + return source; +} + +var platformType = 'generic-tv'; diff --git a/package.json b/package.json index 7208a7a..35ab011 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,13 @@ "scripts": { "prepublishOnly": "npm run clean; npm run lint && npm run build", "build": "webpack --config webpack.prod.js", - "build-tv": "npm run build && npm run copyToTizen && npm run copyToWebOS", + "build-tv": "npm run build && npm run copyToTizen && npm run copyToWebOS && npm run copyToGenericTV", "build:dev": "webpack --config webpack.dev.js", - "build-tv:dev": "npm run build:dev && npm run copyToTizen && npm run copyToWebOS", + "build-tv:dev": "npm run build:dev && npm run copyToTizen && npm run copyToWebOS && npm run copyToGenericTV", "start": "webpack serve --open --config webpack.dev.js", "copyToTizen": "mkdir -p ./tizen/js && cp ./dist/js/bitmovin-player-yospace.js ./tizen/js/ && cp ./web/index.html ./tizen && cp ./web/js/*.js ./tizen/js/", "copyToWebOS": "mkdir -p ./WebOS/js && cp ./dist/js/bitmovin-player-yospace.js ./WebOS/js/ && cp ./web/index.html ./WebOS && cp ./web/js/*.js ./WebOS/js/ && npm run insertWebOSScript", + "copyToGenericTV": "mkdir -p ./generic-tv/js && cp ./dist/js/bitmovin-player-yospace.js ./generic-tv/js/ && cp ./web/index.html ./generic-tv && cp ./web/js/*.js ./generic-tv/js/", "insertWebOSScript": "npx replace-in-file '' '' ./WebOS/index.html", "lint": "eslint --quiet src/ && kacl lint", "format": "prettier --write src/", @@ -21,6 +22,7 @@ "clean-tv": "npm run clean-tv-tizen && npm run clean-tv-webos", "clean-tv-tizen": "rm tizen/js/*.js && rm tizen/index.html", "clean-tv-webos": "rm WebOS/js/* && rm WebOS/index.html", + "clean-tv-generic": "rm generic-tv/js/* && rm generic-tv/index.html", "prepare": "husky install" }, "lint-staged": { diff --git a/web/README.md b/web/README.md index 850c5f8..1241e9f 100644 --- a/web/README.md +++ b/web/README.md @@ -6,4 +6,4 @@ This folder contains a sample for how to use the Bitmovin Player Yospace Integra Run `npm run start` in the project root to build the library and open a local web server with this sample page. -Note that the content of this `web/` folder is also used in the [..tizen/](../tizen/) and [../WebOS](../WebOS/) sample apps. +Note that the content of this `web/` folder is also used in the [../tizen/](../tizen/), [../WebOS](../WebOS/), and [../generic-tv/](../generic-tv/) sample apps.