Add unit tests covering version parsing, device identity, browser engine and version-specific behavior for the six device classes, using real user agent strings from the vendor specifications. While adding the TiVoOS test it became apparent that shaka.device.TiVoOS was only listed in build/types/devices, so the device was never required from the uncompiled entry points and therefore never registered in uncompiled/debug builds (nor available to the tests). Add the missing goog.require to shaka-player.uncompiled.js and transmuxer_worker.uncompiled.js. Co-authored-by: Claude Opus 4.8 <[email protected]>
68 lines
2.5 KiB
JavaScript
68 lines
2.5 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Entry point for the transmuxer Web Worker in uncompiled
|
|
* (development) mode. Loads Closure Library via importScripts, pulls in the
|
|
* dependency graph, then goog.require's the transmuxer plugins and the worker
|
|
* entry point.
|
|
*
|
|
* In compiled builds this file is not used — the compiled bundle is loaded
|
|
* directly as the Worker script.
|
|
*/
|
|
|
|
// Closure's base.js uses document.currentScript (or document.write) to resolve
|
|
// relative paths. Neither exists inside a Worker, so we provide a
|
|
// CLOSURE_IMPORT_SCRIPT hook that uses importScripts instead, and set
|
|
// CLOSURE_BASE_PATH so Closure can find its own modules.
|
|
|
|
/* eslint-disable no-restricted-syntax */
|
|
// @ts-ignore
|
|
self.CLOSURE_BASE_PATH =
|
|
'node_modules/google-closure-library/closure/goog/';
|
|
|
|
// Tell Closure to use importScripts for loading dependencies.
|
|
self.CLOSURE_IMPORT_SCRIPT = (src) => {
|
|
importScripts(src);
|
|
return true;
|
|
};
|
|
|
|
// Load Closure Library base and the generated dependency map.
|
|
importScripts(
|
|
'node_modules/google-closure-library/closure/goog/base.js',
|
|
'dist/deps.js');
|
|
|
|
// Pull in all device plugins so DeviceFactory.getDevice() returns the correct
|
|
// device inside the worker (needed by Ac3Transmuxer and MimeUtils codec
|
|
// conversion). Without these, getDevice() always returns DefaultBrowser even
|
|
// on Tizen/WebOS/Xbox/etc.
|
|
goog.require('shaka.device.AppleBrowser');
|
|
goog.require('shaka.device.Chromecast');
|
|
goog.require('shaka.device.DefaultBrowser');
|
|
goog.require('shaka.device.Hisense');
|
|
goog.require('shaka.device.PlayStation');
|
|
goog.require('shaka.device.TitanOS');
|
|
goog.require('shaka.device.TiVoOS');
|
|
goog.require('shaka.device.Tizen');
|
|
goog.require('shaka.device.Vizio');
|
|
goog.require('shaka.device.WebKitSTB');
|
|
goog.require('shaka.device.WebOS');
|
|
goog.require('shaka.device.Xbox');
|
|
|
|
// Pull in the transmuxer plugins so they self-register with
|
|
// TransmuxerEngine, then load the worker entry point.
|
|
goog.require('shaka.transmuxer.AacTransmuxer');
|
|
goog.require('shaka.transmuxer.Ac3Transmuxer');
|
|
goog.require('shaka.transmuxer.Ec3Transmuxer');
|
|
goog.require('shaka.transmuxer.LocTransmuxer');
|
|
goog.require('shaka.transmuxer.Mp3Transmuxer');
|
|
goog.require('shaka.transmuxer.MpegTsTransmuxer');
|
|
goog.require('shaka.transmuxer.TsTransmuxer');
|
|
goog.require('shaka.transmuxer.TransmuxerWorker');
|
|
|
|
// The auto-boot at the bottom of transmuxer_worker.js will have already
|
|
// called TransmuxerWorker.boot() when it was loaded by goog.require above.
|