mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
b805d15444
Issue #1157 Change-Id: Ib8ddecc7106fea8c24c10cfac406c4709a3f275b
273 lines
5.2 KiB
JavaScript
273 lines
5.2 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2016 Google 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.
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Google Cast API externs.
|
|
* Based on the {@link https://bit.ly/CastApi Google Cast API}.
|
|
* @externs
|
|
*/
|
|
|
|
|
|
/** @type {function(boolean)} */
|
|
var __onGCastApiAvailable;
|
|
|
|
|
|
/** @const */
|
|
var cast = {};
|
|
|
|
|
|
/** @const */
|
|
cast.receiver = {};
|
|
|
|
|
|
/** @const */
|
|
cast.receiver.system = {};
|
|
|
|
|
|
cast.receiver.system.SystemVolumeData = class {
|
|
constructor() {
|
|
/** @type {number} */
|
|
this.level;
|
|
|
|
/** @type {boolean} */
|
|
this.muted;
|
|
}
|
|
};
|
|
|
|
|
|
cast.receiver.CastMessageBus = class {
|
|
/** @param {*} message */
|
|
broadcast(message) {}
|
|
|
|
/**
|
|
* @param {string} senderId
|
|
* @return {!cast.receiver.CastChannel}
|
|
*/
|
|
getCastChannel(senderId) {}
|
|
};
|
|
|
|
|
|
/** @type {Function} */
|
|
cast.receiver.CastMessageBus.prototype.onMessage;
|
|
|
|
|
|
/**
|
|
* @constructor
|
|
* @struct
|
|
*/
|
|
cast.receiver.CastMessageBus.Event = class {};
|
|
|
|
|
|
/** @type {?} */
|
|
cast.receiver.CastMessageBus.Event.prototype.data;
|
|
|
|
|
|
/** @type {string} */
|
|
cast.receiver.CastMessageBus.Event.prototype.senderId;
|
|
|
|
|
|
cast.receiver.CastChannel = class {
|
|
/** @param {*} message */
|
|
send(message) {}
|
|
};
|
|
|
|
|
|
cast.receiver.CastReceiverManager = class {
|
|
constructor() {
|
|
/** @type {Function} */
|
|
this.onSenderConnected;
|
|
|
|
/** @type {Function} */
|
|
this.onSenderDisconnected;
|
|
|
|
/** @type {Function} */
|
|
this.onSystemVolumeChanged;
|
|
}
|
|
|
|
/** @return {cast.receiver.CastReceiverManager} */
|
|
static getInstance() {}
|
|
|
|
/**
|
|
* @param {string} namespace
|
|
* @param {string=} messageType
|
|
* @return {cast.receiver.CastMessageBus}
|
|
*/
|
|
getCastMessageBus(namespace, messageType) {}
|
|
|
|
/** @return {Array.<string>} */
|
|
getSenders() {}
|
|
|
|
start() {}
|
|
|
|
stop() {}
|
|
|
|
/** @return {?cast.receiver.system.SystemVolumeData} */
|
|
getSystemVolume() {}
|
|
|
|
/** @param {number} level */
|
|
setSystemVolumeLevel(level) {}
|
|
|
|
/** @param {number} muted */
|
|
setSystemVolumeMuted(muted) {}
|
|
|
|
/** @return {boolean} */
|
|
isSystemReady() {}
|
|
};
|
|
|
|
|
|
/** @const */
|
|
cast.__platform__ = class {
|
|
/**
|
|
* @param {string} type
|
|
* @return {boolean}
|
|
*/
|
|
static canDisplayType(type) {}
|
|
};
|
|
|
|
|
|
/** @const */
|
|
var chrome = {};
|
|
|
|
|
|
/** @const */
|
|
chrome.cast = class {
|
|
/**
|
|
* @param {chrome.cast.ApiConfig} apiConfig
|
|
* @param {Function} successCallback
|
|
* @param {Function} errorCallback
|
|
*/
|
|
static initialize(apiConfig, successCallback, errorCallback) {}
|
|
|
|
/**
|
|
* @param {Function} successCallback
|
|
* @param {Function} errorCallback
|
|
* @param {chrome.cast.SessionRequest=} sessionRequest
|
|
*/
|
|
static requestSession(successCallback, errorCallback, sessionRequest) {}
|
|
};
|
|
|
|
|
|
/** @type {boolean} */
|
|
chrome.cast.isAvailable;
|
|
|
|
|
|
/** @const */
|
|
chrome.cast.SessionStatus = {};
|
|
|
|
|
|
/** @type {string} */
|
|
chrome.cast.SessionStatus.STOPPED;
|
|
|
|
|
|
chrome.cast.ApiConfig = class {
|
|
/**
|
|
* @param {chrome.cast.SessionRequest} sessionRequest
|
|
* @param {Function} sessionListener
|
|
* @param {Function} receiverListener
|
|
* @param {string=} autoJoinPolicy
|
|
* @param {string=} defaultActionPolicy
|
|
*/
|
|
constructor(sessionRequest, sessionListener, receiverListener,
|
|
autoJoinPolicy, defaultActionPolicy) {}
|
|
};
|
|
|
|
|
|
chrome.cast.Error = class {
|
|
/**
|
|
* @param {string} code
|
|
* @param {string=} description
|
|
* @param {Object=} details
|
|
*/
|
|
constructor(code, description, details) {
|
|
/** @type {string} */
|
|
this.code;
|
|
|
|
/** @type {?string} */
|
|
this.description;
|
|
|
|
/** @type {Object} */
|
|
this.details;
|
|
}
|
|
};
|
|
|
|
|
|
chrome.cast.Receiver = class {
|
|
constructor() {}
|
|
};
|
|
|
|
|
|
/** @const {string} */
|
|
chrome.cast.Receiver.prototype.friendlyName;
|
|
|
|
|
|
chrome.cast.Session = class {
|
|
constructor() {
|
|
/** @type {string} */
|
|
this.sessionId;
|
|
|
|
/** @type {string} */
|
|
this.status;
|
|
|
|
/** @type {chrome.cast.Receiver} */
|
|
this.receiver;
|
|
}
|
|
|
|
/**
|
|
* @param {string} namespace
|
|
* @param {Function} listener
|
|
*/
|
|
addMessageListener(namespace, listener) {}
|
|
|
|
/**
|
|
* @param {string} namespace
|
|
* @param {Function} listener
|
|
*/
|
|
removeMessageListener(namespace, listener) {}
|
|
|
|
/** @param {Function} listener */
|
|
addUpdateListener(listener) {}
|
|
|
|
/** @param {Function} listener */
|
|
removeUpdateListener(listener) {}
|
|
|
|
/**
|
|
* @param {Function} successCallback
|
|
* @param {Function} errorCallback
|
|
*/
|
|
leave(successCallback, errorCallback) {}
|
|
|
|
/**
|
|
* @param {string} namespace
|
|
* @param {!Object|string} message
|
|
* @param {Function} successCallback
|
|
* @param {Function} errorCallback
|
|
*/
|
|
sendMessage(namespace, message, successCallback, errorCallback) {}
|
|
|
|
/**
|
|
* @param {Function} successCallback
|
|
* @param {Function} errorCallback
|
|
*/
|
|
stop(successCallback, errorCallback) {}
|
|
};
|
|
|
|
|
|
chrome.cast.SessionRequest = class {
|
|
/** @param {string} appId */
|
|
constructor(appId) {}
|
|
};
|