ionic-chromecast 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ export interface InitializeOptions {
2
+ /**
3
+ * The receiver application ID for Google Cast
4
+ * Use "CC1AD845" for the default media receiver
5
+ */
6
+ receiverApplicationId: string;
7
+ }
8
+ export interface RequestSessionResult {
9
+ success: boolean;
10
+ message?: string;
11
+ }
12
+ export interface SessionStatusResult {
13
+ active: boolean;
14
+ message?: string;
15
+ }
16
+ export interface DevicesAvailableResult {
17
+ available: boolean;
18
+ message?: string;
19
+ }
20
+ export interface MediaMetadata {
21
+ title?: string;
22
+ subtitle?: string;
23
+ images?: string[];
24
+ studio?: string;
25
+ contentType?: string;
26
+ duration?: number;
27
+ [key: string]: any;
28
+ }
29
+ export interface LoadMediaOptions {
30
+ url: string;
31
+ metadata?: MediaMetadata;
32
+ }
33
+ export interface PluginListenerHandle {
34
+ remove: () => Promise<void>;
35
+ }
36
+ export declare type ChromecastEventType = 'sessionStarted' | 'sessionEnded' | 'mediaLoaded' | 'mediaError' | 'deviceAvailable' | 'deviceUnavailable' | 'volumeChanged' | 'playbackStatusChanged';
37
+ export interface ChromecastEvent {
38
+ type: ChromecastEventType;
39
+ data?: any;
40
+ }
41
+ export interface IonicChromecastPlugin {
42
+ /**
43
+ * Initialize the Google Cast SDK
44
+ * Must be called before any other Cast operations
45
+ */
46
+ initialize(options: InitializeOptions): Promise<{
47
+ success: boolean;
48
+ }>;
49
+ echo(options: {
50
+ value: string;
51
+ }): Promise<{
52
+ value: string;
53
+ }>;
54
+ /**
55
+ * Request a Cast session (Android only)
56
+ */
57
+ requestSession(): Promise<RequestSessionResult>;
58
+ /**
59
+ * Check if there is an active Cast session (Android only)
60
+ */
61
+ isSessionActive(): Promise<SessionStatusResult>;
62
+ /**
63
+ * Check if there are available Cast devices (Android only)
64
+ */
65
+ areDevicesAvailable(): Promise<DevicesAvailableResult>;
66
+ /**
67
+ * Load media on the Cast device (Android only)
68
+ */
69
+ loadMedia(options: LoadMediaOptions): Promise<{
70
+ success: boolean;
71
+ message?: string;
72
+ }>;
73
+ /**
74
+ * Listen to Chromecast events (Android only)
75
+ */
76
+ addListener(eventName: ChromecastEventType, listenerFunc: (event: ChromecastEvent) => void): PluginListenerHandle;
77
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n /**\n * The receiver application ID for Google Cast\n * Use \"CC1AD845\" for the default media receiver\n */\n receiverApplicationId: string;\n}\n\nexport interface RequestSessionResult {\n success: boolean;\n message?: string;\n}\n\nexport interface SessionStatusResult {\n active: boolean;\n message?: string;\n}\n\nexport interface DevicesAvailableResult {\n available: boolean;\n message?: string;\n}\n\nexport interface MediaMetadata {\n title?: string;\n subtitle?: string;\n images?: string[]; // URLs to images\n studio?: string;\n contentType?: string; // e.g. 'video/mp4'\n duration?: number; // in seconds\n [key: string]: any; // allow extra optional metadata\n}\n\nexport interface LoadMediaOptions {\n url: string;\n metadata?: MediaMetadata;\n}\n\nexport interface PluginListenerHandle {\n remove: () => Promise<void>;\n}\n\nexport type ChromecastEventType =\n | 'sessionStarted'\n | 'sessionEnded'\n | 'mediaLoaded'\n | 'mediaError'\n | 'deviceAvailable'\n | 'deviceUnavailable'\n | 'volumeChanged'\n | 'playbackStatusChanged';\n\nexport interface ChromecastEvent {\n type: ChromecastEventType;\n data?: any;\n}\n\nexport interface IonicChromecastPlugin {\n /**\n * Initialize the Google Cast SDK\n * Must be called before any other Cast operations\n */\n initialize(options: InitializeOptions): Promise<{ success: boolean }>;\n\n echo(options: { value: string }): Promise<{ value: string }>;\n\n /**\n * Request a Cast session (Android only)\n */\n requestSession(): Promise<RequestSessionResult>;\n\n /**\n * Check if there is an active Cast session (Android only)\n */\n isSessionActive(): Promise<SessionStatusResult>;\n\n /**\n * Check if there are available Cast devices (Android only)\n */\n areDevicesAvailable(): Promise<DevicesAvailableResult>;\n\n /**\n * Load media on the Cast device (Android only)\n */\n loadMedia(options: LoadMediaOptions): Promise<{ success: boolean; message?: string }>;\n\n /**\n * Listen to Chromecast events (Android only)\n */\n addListener(\n eventName: ChromecastEventType,\n listenerFunc: (event: ChromecastEvent) => void\n ): PluginListenerHandle;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { IonicChromecastPlugin } from './definitions';
2
+ declare const IonicChromecast: IonicChromecastPlugin;
3
+ export * from './definitions';
4
+ export { IonicChromecast };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const IonicChromecast = registerPlugin('IonicChromecast', {
3
+ web: () => import('./web').then((m) => new m.IonicChromecastWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { IonicChromecast };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,eAAe,GAAG,cAAc,CAAwB,iBAAiB,EAAE;IAC/E,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;CACnE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { IonicChromecastPlugin } from './definitions';\n\nconst IonicChromecast = registerPlugin<IonicChromecastPlugin>('IonicChromecast', {\n web: () => import('./web').then((m) => new m.IonicChromecastWeb()),\n});\n\nexport * from './definitions';\nexport { IonicChromecast };\n"]}
@@ -0,0 +1,32 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { InitializeOptions, IonicChromecastPlugin, ChromecastEventType, ChromecastEvent, PluginListenerHandle } from './definitions';
3
+ export declare class IonicChromecastWeb extends WebPlugin implements IonicChromecastPlugin {
4
+ initialize(options: InitializeOptions): Promise<{
5
+ success: boolean;
6
+ }>;
7
+ echo(options: {
8
+ value: string;
9
+ }): Promise<{
10
+ value: string;
11
+ }>;
12
+ requestSession(): Promise<{
13
+ success: boolean;
14
+ message?: string;
15
+ }>;
16
+ isSessionActive(): Promise<{
17
+ active: boolean;
18
+ message?: string;
19
+ }>;
20
+ areDevicesAvailable(): Promise<{
21
+ available: boolean;
22
+ message?: string;
23
+ }>;
24
+ loadMedia(_: {
25
+ url: string;
26
+ metadata?: any;
27
+ }): Promise<{
28
+ success: boolean;
29
+ message?: string;
30
+ }>;
31
+ addListener(_eventName: ChromecastEventType, _listenerFunc: (event: ChromecastEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
32
+ }
@@ -0,0 +1,38 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class IonicChromecastWeb extends WebPlugin {
3
+ async initialize(options) {
4
+ console.log('Cast SDK initialize called on web with options:', options);
5
+ console.warn('Google Cast SDK is not supported on web. This is a no-op implementation.');
6
+ return { success: false };
7
+ }
8
+ async echo(options) {
9
+ console.log('ECHO', options);
10
+ return options;
11
+ }
12
+ async requestSession() {
13
+ console.warn('requestSession() is not supported on web.');
14
+ return { success: false, message: 'Google Cast session is only available on Android.' };
15
+ }
16
+ async isSessionActive() {
17
+ console.warn('isSessionActive() is not supported on web.');
18
+ return { active: false, message: 'Session detection only available on Android.' };
19
+ }
20
+ async areDevicesAvailable() {
21
+ console.warn('areDevicesAvailable() is not supported on web.');
22
+ return { available: false, message: 'Device detection only available on Android.' };
23
+ }
24
+ async loadMedia(_) {
25
+ console.warn('loadMedia() is not supported on web.');
26
+ return { success: false, message: 'Media casting only available on Android.' };
27
+ }
28
+ addListener(_eventName, _listenerFunc) {
29
+ console.warn('addListener() is not supported on web.');
30
+ const handle = {
31
+ remove: async () => {
32
+ /* no-op */
33
+ }
34
+ };
35
+ return Object.assign(Promise.resolve(handle), handle);
36
+ }
37
+ }
38
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAE/C,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,OAAO,CAAC,GAAG,CAAC,iDAAiD,EAAE,OAAO,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACzF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,mDAAmD,EAAE,CAAC;IAC1F,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QAC3D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,6CAA6C,EAAE,CAAC;IACtF,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,CAAkC;QAChD,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC;IACjF,CAAC;IACD,WAAW,CACT,UAA+B,EAC/B,aAA+C;QAE/C,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG;YACb,MAAM,EAAE,KAAK,IAAI,EAAE;gBACjB,WAAW;YACb,CAAC;SACF,CAAC;QACF,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n InitializeOptions,\n IonicChromecastPlugin,\n ChromecastEventType,\n ChromecastEvent,\n PluginListenerHandle,\n} from './definitions';\n\nexport class IonicChromecastWeb extends WebPlugin implements IonicChromecastPlugin {\n \n async initialize(options: InitializeOptions): Promise<{ success: boolean }> {\n console.log('Cast SDK initialize called on web with options:', options);\n console.warn('Google Cast SDK is not supported on web. This is a no-op implementation.');\n return { success: false };\n }\n\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async requestSession(): Promise<{ success: boolean; message?: string }> {\n console.warn('requestSession() is not supported on web.');\n return { success: false, message: 'Google Cast session is only available on Android.' };\n }\n\n async isSessionActive(): Promise<{ active: boolean; message?: string }> {\n console.warn('isSessionActive() is not supported on web.');\n return { active: false, message: 'Session detection only available on Android.' };\n }\n\n async areDevicesAvailable(): Promise<{ available: boolean; message?: string }> {\n console.warn('areDevicesAvailable() is not supported on web.');\n return { available: false, message: 'Device detection only available on Android.' };\n }\n\n async loadMedia(_: { url: string; metadata?: any }): Promise<{ success: boolean; message?: string }> {\n console.warn('loadMedia() is not supported on web.');\n return { success: false, message: 'Media casting only available on Android.' };\n }\n addListener(\n _eventName: ChromecastEventType,\n _listenerFunc: (event: ChromecastEvent) => void\n ): Promise<PluginListenerHandle> & PluginListenerHandle {\n console.warn('addListener() is not supported on web.');\n const handle = {\n remove: async () => {\n /* no-op */\n }\n };\n return Object.assign(Promise.resolve(handle), handle);\n }\n}\n"]}
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const IonicChromecast = core.registerPlugin('IonicChromecast', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.IonicChromecastWeb()),
7
+ });
8
+
9
+ class IonicChromecastWeb extends core.WebPlugin {
10
+ async initialize(options) {
11
+ console.log('Cast SDK initialize called on web with options:', options);
12
+ console.warn('Google Cast SDK is not supported on web. This is a no-op implementation.');
13
+ return { success: false };
14
+ }
15
+ async echo(options) {
16
+ console.log('ECHO', options);
17
+ return options;
18
+ }
19
+ async requestSession() {
20
+ console.warn('requestSession() is not supported on web.');
21
+ return { success: false, message: 'Google Cast session is only available on Android.' };
22
+ }
23
+ async isSessionActive() {
24
+ console.warn('isSessionActive() is not supported on web.');
25
+ return { active: false, message: 'Session detection only available on Android.' };
26
+ }
27
+ async areDevicesAvailable() {
28
+ console.warn('areDevicesAvailable() is not supported on web.');
29
+ return { available: false, message: 'Device detection only available on Android.' };
30
+ }
31
+ async loadMedia(_) {
32
+ console.warn('loadMedia() is not supported on web.');
33
+ return { success: false, message: 'Media casting only available on Android.' };
34
+ }
35
+ addListener(_eventName, _listenerFunc) {
36
+ console.warn('addListener() is not supported on web.');
37
+ const handle = {
38
+ remove: async () => {
39
+ /* no-op */
40
+ }
41
+ };
42
+ return Object.assign(Promise.resolve(handle), handle);
43
+ }
44
+ }
45
+
46
+ var web = /*#__PURE__*/Object.freeze({
47
+ __proto__: null,
48
+ IonicChromecastWeb: IonicChromecastWeb
49
+ });
50
+
51
+ exports.IonicChromecast = IonicChromecast;
52
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst IonicChromecast = registerPlugin('IonicChromecast', {\n web: () => import('./web').then((m) => new m.IonicChromecastWeb()),\n});\nexport * from './definitions';\nexport { IonicChromecast };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class IonicChromecastWeb extends WebPlugin {\n async initialize(options) {\n console.log('Cast SDK initialize called on web with options:', options);\n console.warn('Google Cast SDK is not supported on web. This is a no-op implementation.');\n return { success: false };\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async requestSession() {\n console.warn('requestSession() is not supported on web.');\n return { success: false, message: 'Google Cast session is only available on Android.' };\n }\n async isSessionActive() {\n console.warn('isSessionActive() is not supported on web.');\n return { active: false, message: 'Session detection only available on Android.' };\n }\n async areDevicesAvailable() {\n console.warn('areDevicesAvailable() is not supported on web.');\n return { available: false, message: 'Device detection only available on Android.' };\n }\n async loadMedia(_) {\n console.warn('loadMedia() is not supported on web.');\n return { success: false, message: 'Media casting only available on Android.' };\n }\n addListener(_eventName, _listenerFunc) {\n console.warn('addListener() is not supported on web.');\n const handle = {\n remove: async () => {\n /* no-op */\n }\n };\n return Object.assign(Promise.resolve(handle), handle);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACtE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,iDAAiD,EAAE,OAAO,CAAC;AAC/E,QAAQ,OAAO,CAAC,IAAI,CAAC,0EAA0E,CAAC;AAChG,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC;AACjE,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,mDAAmD,EAAE;AAC/F,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC;AAClE,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,8CAA8C,EAAE;AACzF,IAAI;AACJ,IAAI,MAAM,mBAAmB,GAAG;AAChC,QAAQ,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC;AACtE,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,6CAA6C,EAAE;AAC3F,IAAI;AACJ,IAAI,MAAM,SAAS,CAAC,CAAC,EAAE;AACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC;AAC5D,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,0CAA0C,EAAE;AACtF,IAAI;AACJ,IAAI,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE;AAC3C,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC;AAC9D,QAAQ,MAAM,MAAM,GAAG;AACvB,YAAY,MAAM,EAAE,YAAY;AAChC;AACA,YAAY;AACZ,SAAS;AACT,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;AAC7D,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,55 @@
1
+ var capacitorIonicChromecast = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const IonicChromecast = core.registerPlugin('IonicChromecast', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.IonicChromecastWeb()),
6
+ });
7
+
8
+ class IonicChromecastWeb extends core.WebPlugin {
9
+ async initialize(options) {
10
+ console.log('Cast SDK initialize called on web with options:', options);
11
+ console.warn('Google Cast SDK is not supported on web. This is a no-op implementation.');
12
+ return { success: false };
13
+ }
14
+ async echo(options) {
15
+ console.log('ECHO', options);
16
+ return options;
17
+ }
18
+ async requestSession() {
19
+ console.warn('requestSession() is not supported on web.');
20
+ return { success: false, message: 'Google Cast session is only available on Android.' };
21
+ }
22
+ async isSessionActive() {
23
+ console.warn('isSessionActive() is not supported on web.');
24
+ return { active: false, message: 'Session detection only available on Android.' };
25
+ }
26
+ async areDevicesAvailable() {
27
+ console.warn('areDevicesAvailable() is not supported on web.');
28
+ return { available: false, message: 'Device detection only available on Android.' };
29
+ }
30
+ async loadMedia(_) {
31
+ console.warn('loadMedia() is not supported on web.');
32
+ return { success: false, message: 'Media casting only available on Android.' };
33
+ }
34
+ addListener(_eventName, _listenerFunc) {
35
+ console.warn('addListener() is not supported on web.');
36
+ const handle = {
37
+ remove: async () => {
38
+ /* no-op */
39
+ }
40
+ };
41
+ return Object.assign(Promise.resolve(handle), handle);
42
+ }
43
+ }
44
+
45
+ var web = /*#__PURE__*/Object.freeze({
46
+ __proto__: null,
47
+ IonicChromecastWeb: IonicChromecastWeb
48
+ });
49
+
50
+ exports.IonicChromecast = IonicChromecast;
51
+
52
+ return exports;
53
+
54
+ })({}, capacitorExports);
55
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst IonicChromecast = registerPlugin('IonicChromecast', {\n web: () => import('./web').then((m) => new m.IonicChromecastWeb()),\n});\nexport * from './definitions';\nexport { IonicChromecast };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class IonicChromecastWeb extends WebPlugin {\n async initialize(options) {\n console.log('Cast SDK initialize called on web with options:', options);\n console.warn('Google Cast SDK is not supported on web. This is a no-op implementation.');\n return { success: false };\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async requestSession() {\n console.warn('requestSession() is not supported on web.');\n return { success: false, message: 'Google Cast session is only available on Android.' };\n }\n async isSessionActive() {\n console.warn('isSessionActive() is not supported on web.');\n return { active: false, message: 'Session detection only available on Android.' };\n }\n async areDevicesAvailable() {\n console.warn('areDevicesAvailable() is not supported on web.');\n return { available: false, message: 'Device detection only available on Android.' };\n }\n async loadMedia(_) {\n console.warn('loadMedia() is not supported on web.');\n return { success: false, message: 'Media casting only available on Android.' };\n }\n addListener(_eventName, _listenerFunc) {\n console.warn('addListener() is not supported on web.');\n const handle = {\n remove: async () => {\n /* no-op */\n }\n };\n return Object.assign(Promise.resolve(handle), handle);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACtE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,iDAAiD,EAAE,OAAO,CAAC;IAC/E,QAAQ,OAAO,CAAC,IAAI,CAAC,0EAA0E,CAAC;IAChG,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC;IACjE,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,mDAAmD,EAAE;IAC/F,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC;IAClE,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,8CAA8C,EAAE;IACzF,IAAI;IACJ,IAAI,MAAM,mBAAmB,GAAG;IAChC,QAAQ,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC;IACtE,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,6CAA6C,EAAE;IAC3F,IAAI;IACJ,IAAI,MAAM,SAAS,CAAC,CAAC,EAAE;IACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC;IAC5D,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,0CAA0C,EAAE;IACtF,IAAI;IACJ,IAAI,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE;IAC3C,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC;IAC9D,QAAQ,MAAM,MAAM,GAAG;IACvB,YAAY,MAAM,EAAE,YAAY;IAChC;IACA,YAAY;IACZ,SAAS;IACT,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC7D,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ import Foundation
2
+
3
+ @objc public class IonicChromecast: NSObject {
4
+ @objc public func echo(_ value: String) -> String {
5
+ print(value)
6
+ return value
7
+ }
8
+ }
@@ -0,0 +1,23 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ /**
5
+ * Please read the Capacitor iOS Plugin Development Guide
6
+ * here: https://capacitorjs.com/docs/plugins/ios
7
+ */
8
+ @objc(IonicChromecastPlugin)
9
+ public class IonicChromecastPlugin: CAPPlugin, CAPBridgedPlugin {
10
+ public let identifier = "IonicChromecastPlugin"
11
+ public let jsName = "IonicChromecast"
12
+ public let pluginMethods: [CAPPluginMethod] = [
13
+ CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise)
14
+ ]
15
+ private let implementation = IonicChromecast()
16
+
17
+ @objc func echo(_ call: CAPPluginCall) {
18
+ let value = call.getString("value") ?? ""
19
+ call.resolve([
20
+ "value": implementation.echo(value)
21
+ ])
22
+ }
23
+ }
@@ -0,0 +1,15 @@
1
+ import XCTest
2
+ @testable import IonicChromecastPlugin
3
+
4
+ class IonicChromecastTests: XCTestCase {
5
+ func testEcho() {
6
+ // This is an example of a functional test case for a plugin.
7
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
8
+
9
+ let implementation = IonicChromecast()
10
+ let value = "Hello, World!"
11
+ let result = implementation.echo(value)
12
+
13
+ XCTAssertEqual(value, result)
14
+ }
15
+ }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "ionic-chromecast",
3
+ "version": "0.0.1",
4
+ "description": "Capacitor plugin for Google Cast SDK (Chromecast) integration with Android support",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
16
+ "IonicChromecast.podspec"
17
+ ],
18
+ "author": "Fabian Acevedo",
19
+ "license": "Apache-2.0",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Facevedo74/ionic-chromecast.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/Facevedo74/ionic-chromecast/issues"
26
+ },
27
+ "keywords": [
28
+ "capacitor",
29
+ "plugin",
30
+ "native",
31
+ "chromecast",
32
+ "google-cast",
33
+ "cast-sdk",
34
+ "android",
35
+ "ionic",
36
+ "streaming",
37
+ "media"
38
+ ],
39
+ "scripts": {
40
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
41
+ "verify:ios": "xcodebuild -scheme IonicChromecast -destination generic/platform=iOS",
42
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
43
+ "verify:web": "npm run build",
44
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
45
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
46
+ "eslint": "eslint . --ext ts",
47
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
48
+ "swiftlint": "node-swiftlint",
49
+ "docgen": "docgen --api IonicChromecastPlugin --output-readme README.md --output-json dist/docs.json",
50
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
51
+ "clean": "rimraf ./dist",
52
+ "watch": "tsc --watch",
53
+ "prepublishOnly": "npm run build"
54
+ },
55
+ "devDependencies": {
56
+ "@capacitor/android": "^7.0.0",
57
+ "@capacitor/core": "^7.0.0",
58
+ "@capacitor/docgen": "^0.3.0",
59
+ "@capacitor/ios": "^7.0.0",
60
+ "@ionic/eslint-config": "^0.4.0",
61
+ "@ionic/prettier-config": "^4.0.0",
62
+ "@ionic/swiftlint-config": "^2.0.0",
63
+ "eslint": "^8.57.0",
64
+ "prettier": "^3.4.2",
65
+ "prettier-plugin-java": "^2.6.6",
66
+ "rimraf": "^6.0.1",
67
+ "rollup": "^4.30.1",
68
+ "swiftlint": "^2.0.0",
69
+ "typescript": "~4.1.5"
70
+ },
71
+ "peerDependencies": {
72
+ "@capacitor/core": ">=7.0.0"
73
+ },
74
+ "prettier": "@ionic/prettier-config",
75
+ "swiftlint": "@ionic/swiftlint-config",
76
+ "eslintConfig": {
77
+ "extends": "@ionic/eslint-config/recommended"
78
+ },
79
+ "capacitor": {
80
+ "ios": {
81
+ "src": "ios"
82
+ },
83
+ "android": {
84
+ "src": "android"
85
+ }
86
+ }
87
+ }