mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
61d80f6e59
Internally this uses Web Speech API https://webaudio.github.io/web-speech-api/ and Translator APIs https://webmachinelearning.github.io/translation-api/ The feature is experimental and disabled by default since Chrome is the only browser that currently supports it. Closes https://github.com/shaka-project/shaka-player/issues/9110 --------- Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com> Co-authored-by: Joey Parrish <joeyparrish@google.com> Co-authored-by: Theodore Abshire <TheodoreAbshire@Gmail.com> Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
121 lines
2.0 KiB
JavaScript
121 lines
2.0 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Externs for Translator and Language Detector APIs.
|
|
*
|
|
* @externs
|
|
*/
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function Translator() {}
|
|
|
|
/**
|
|
@type {number}
|
|
*/
|
|
Translator.prototype.inputQuota;
|
|
|
|
/**
|
|
@type {string}
|
|
*/
|
|
Translator.prototype.sourceLanguage;
|
|
|
|
/**
|
|
@type {string}
|
|
*/
|
|
Translator.prototype.targetLanguage;
|
|
|
|
/**
|
|
@return {void}
|
|
*/
|
|
Translator.prototype.destroy = function() {};
|
|
|
|
/**
|
|
* @param {string} text
|
|
* @return {!Promise<number>}
|
|
*/
|
|
Translator.prototype.measureInputUsage = function(text) {};
|
|
|
|
/**
|
|
* @param {string} text
|
|
* @return {!Promise<string>}
|
|
*/
|
|
Translator.prototype.translate = function(text) {};
|
|
|
|
/**
|
|
* @param {string} text
|
|
* @return {!ReadableStream<string>}
|
|
*/
|
|
Translator.prototype.translateStreaming = function(text) {};
|
|
|
|
/**
|
|
* @param {(Object|null)=} options
|
|
* @return {!Promise<string>}
|
|
*/
|
|
Translator.availability = function(options) {};
|
|
|
|
/**
|
|
* @param {(Object|null)=} options
|
|
* @return {!Promise<!Translator>}
|
|
*/
|
|
Translator.create = function(options) {};
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function LanguageDetector() {}
|
|
|
|
/**
|
|
@type {number}
|
|
*/
|
|
LanguageDetector.prototype.inputQuota;
|
|
|
|
/**
|
|
@return {void}
|
|
*/
|
|
LanguageDetector.prototype.destroy = function() {};
|
|
|
|
/**
|
|
* @param {string} text
|
|
* @return {!Promise<number>}
|
|
*/
|
|
LanguageDetector.prototype.measureInputUsage = function(text) {};
|
|
|
|
/**
|
|
* @param {string} text
|
|
* @return {!Promise<Array<{detectedLanguage: string, confidence: number}>>}
|
|
*/
|
|
LanguageDetector.prototype.detect = function(text) {};
|
|
|
|
/**
|
|
* @param {(Object|null)=} options
|
|
* @return {!Promise<string>}
|
|
*/
|
|
LanguageDetector.availability = function(options) {};
|
|
|
|
/**
|
|
* @param {(Object|null)=} options
|
|
* @return {!Promise<!LanguageDetector>}
|
|
*/
|
|
LanguageDetector.create = function(options) {};
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function CreateMonitor() {}
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
function DownloadProgressEvent() {}
|
|
|
|
/**
|
|
@type {number}
|
|
*/
|
|
DownloadProgressEvent.prototype.loaded;
|