mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 10:39:57 +00:00
Minor cast.framework changes
This commit is contained in:
@@ -25,7 +25,7 @@ type EventHandler = (eventData:
|
|||||||
type MessageListener = (namespace: string, message: string) => void;
|
type MessageListener = (namespace: string, message: string) => void;
|
||||||
|
|
||||||
|
|
||||||
export default class RemotePlayer {
|
export default class CastSession {
|
||||||
constructor (sessionObj: Session, state: string) {
|
constructor (sessionObj: Session, state: string) {
|
||||||
console.info("STUB :: CastSession#constructor");
|
console.info("STUB :: CastSession#constructor");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,16 +44,22 @@ export default {
|
|||||||
, RemotePlayer, RemotePlayerChangedEvent, RemotePlayerController
|
, RemotePlayer, RemotePlayerChangedEvent, RemotePlayerController
|
||||||
, SessionStateEventData, VolumeEventData
|
, SessionStateEventData, VolumeEventData
|
||||||
|
|
||||||
, CastContext: Object.assign(CastContext, {
|
/**
|
||||||
getInstance () {
|
* CastContext class with an extra getInstance method used to
|
||||||
|
* instantiate and fetch a singleton instance.
|
||||||
|
*/
|
||||||
|
, CastContext: {
|
||||||
|
...CastContext
|
||||||
|
|
||||||
|
, getInstance () {
|
||||||
if (castContext) {
|
if (castContext) {
|
||||||
return castContext;
|
return castContext
|
||||||
}
|
}
|
||||||
|
|
||||||
castContext = new CastContext();
|
castContext = new CastContext();
|
||||||
return castContext;
|
return castContext;
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
, VERSION: "1.0.07"
|
, VERSION: "1.0.07"
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,14 @@ import { onMessage } from "./messageBridge";
|
|||||||
|
|
||||||
const global = (window as any);
|
const global = (window as any);
|
||||||
|
|
||||||
if (!global.chrome) {
|
global.chrome = {};
|
||||||
global.chrome = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
global.chrome.cast = cast;
|
global.chrome.cast = cast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If loaded within a page via a <script> element,
|
||||||
|
* document.currentScript should exist and we can check its
|
||||||
|
* [src] query string for the loadCastFramework param.
|
||||||
|
*/
|
||||||
if (document.currentScript) {
|
if (document.currentScript) {
|
||||||
const currentScript = (document.currentScript as HTMLScriptElement);
|
const currentScript = (document.currentScript as HTMLScriptElement);
|
||||||
const currentScriptUrl = new URL(currentScript.src);
|
const currentScriptUrl = new URL(currentScript.src);
|
||||||
|
|||||||
Reference in New Issue
Block a user