ionic-chromecast 0.0.4 → 0.0.7
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.
- package/README.md +27 -0
- package/android/src/main/java/com/fabianacevedo/ionicchromecast/IonicChromecast.java +98 -4
- package/android/src/main/java/com/fabianacevedo/ionicchromecast/IonicChromecastPlugin.java +98 -0
- package/dist/docs.json +10 -0
- package/dist/esm/definitions.d.ts +7 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +4 -0
- package/dist/esm/web.js +4 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +4 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ A Capacitor plugin for integrating Google Cast SDK (Chromecast) with Ionic/Capac
|
|
|
8
8
|
- ✅ Session management (request, check status)
|
|
9
9
|
- ✅ Device discovery
|
|
10
10
|
- ✅ Media playback with rich metadata
|
|
11
|
+
- ✅ End active Cast session from app
|
|
11
12
|
- ✅ Android support
|
|
12
13
|
- ✅ Event listeners
|
|
13
14
|
- 🚧 iOS support (coming soon)
|
|
@@ -96,6 +97,14 @@ async playVideo() {
|
|
|
96
97
|
console.log('▶️ Video is playing on TV!');
|
|
97
98
|
}
|
|
98
99
|
}
|
|
100
|
+
|
|
101
|
+
// Optional: end the current Cast session from the app
|
|
102
|
+
async stopCasting() {
|
|
103
|
+
const result = await IonicChromecast.endSession();
|
|
104
|
+
if (result.success) {
|
|
105
|
+
console.log('⏹ Cast session ended');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
99
108
|
```
|
|
100
109
|
|
|
101
110
|
## Complete Examples
|
|
@@ -276,6 +285,10 @@ export class CastControlPage implements OnDestroy {
|
|
|
276
285
|
// Clean up listeners
|
|
277
286
|
this.eventListeners.forEach(handle => handle.remove());
|
|
278
287
|
}
|
|
288
|
+
|
|
289
|
+
async stopCast() {
|
|
290
|
+
await IonicChromecast.endSession();
|
|
291
|
+
}
|
|
279
292
|
}
|
|
280
293
|
```
|
|
281
294
|
|
|
@@ -346,6 +359,7 @@ export class CastButtonComponent implements OnInit {
|
|
|
346
359
|
* [`isSessionActive()`](#issessionactive)
|
|
347
360
|
* [`areDevicesAvailable()`](#aredevicesavailable)
|
|
348
361
|
* [`loadMedia(...)`](#loadmedia)
|
|
362
|
+
* [`endSession()`](#endsession)
|
|
349
363
|
* [`addListener(ChromecastEventType, ...)`](#addlistenerchromecasteventtype-)
|
|
350
364
|
* [Interfaces](#interfaces)
|
|
351
365
|
* [Type Aliases](#type-aliases)
|
|
@@ -444,6 +458,19 @@ Load media on the Cast device (Android only)
|
|
|
444
458
|
--------------------
|
|
445
459
|
|
|
446
460
|
|
|
461
|
+
### endSession()
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
endSession() => Promise<{ success: boolean; message?: string; }>
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
End the current Cast session (Android only)
|
|
468
|
+
|
|
469
|
+
**Returns:** <code>Promise<{ success: boolean; message?: string; }></code>
|
|
470
|
+
|
|
471
|
+
--------------------
|
|
472
|
+
|
|
473
|
+
|
|
447
474
|
### addListener(ChromecastEventType, ...)
|
|
448
475
|
|
|
449
476
|
```typescript
|
|
@@ -6,6 +6,7 @@ import android.os.Handler;
|
|
|
6
6
|
import android.os.Looper;
|
|
7
7
|
import com.getcapacitor.Logger;
|
|
8
8
|
import com.google.android.gms.cast.framework.CastContext;
|
|
9
|
+
import com.google.android.gms.cast.framework.SessionManager;
|
|
9
10
|
import com.google.android.gms.common.ConnectionResult;
|
|
10
11
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
11
12
|
import java.util.concurrent.CountDownLatch;
|
|
@@ -141,7 +142,22 @@ public class IonicChromecast {
|
|
|
141
142
|
Runnable check = () -> {
|
|
142
143
|
try {
|
|
143
144
|
CastSession s = castContext.getSessionManager().getCurrentCastSession();
|
|
144
|
-
|
|
145
|
+
boolean connected = s != null && s.isConnected();
|
|
146
|
+
|
|
147
|
+
// Evita falsos positivos: requiere appId y RemoteMediaClient disponibles
|
|
148
|
+
if (connected) {
|
|
149
|
+
try {
|
|
150
|
+
String appId = s.getApplicationMetadata() != null ? s.getApplicationMetadata().getApplicationId() : "";
|
|
151
|
+
RemoteMediaClient rmc = s.getRemoteMediaClient();
|
|
152
|
+
if (rmc == null || appId == null || appId.isEmpty()) {
|
|
153
|
+
connected = false;
|
|
154
|
+
}
|
|
155
|
+
} catch (Exception ignored) {
|
|
156
|
+
connected = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
active.set(connected);
|
|
145
161
|
} catch (Exception e) {
|
|
146
162
|
Logger.error(TAG, "Error checking session status: " + e.getMessage(), e);
|
|
147
163
|
active.set(false);
|
|
@@ -167,6 +183,59 @@ public class IonicChromecast {
|
|
|
167
183
|
return active.get();
|
|
168
184
|
}
|
|
169
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Finaliza la sesión Cast actual, si existe
|
|
188
|
+
*/
|
|
189
|
+
public boolean endSession() {
|
|
190
|
+
if (!isInitialized || castContext == null) {
|
|
191
|
+
lastError = "Cast SDK not initialized. Call initialize() first.";
|
|
192
|
+
Logger.error(TAG, lastError, null);
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
lastError = null;
|
|
197
|
+
final AtomicBoolean success = new AtomicBoolean(false);
|
|
198
|
+
final CountDownLatch latch = new CountDownLatch(1);
|
|
199
|
+
Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
200
|
+
|
|
201
|
+
Runnable endRunnable = () -> {
|
|
202
|
+
try {
|
|
203
|
+
SessionManager sm = castContext.getSessionManager();
|
|
204
|
+
if (sm == null) {
|
|
205
|
+
lastError = "SessionManager is null";
|
|
206
|
+
Logger.error(TAG, lastError, null);
|
|
207
|
+
latch.countDown();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
CastSession session = sm.getCurrentCastSession();
|
|
212
|
+
if (session == null || !session.isConnected()) {
|
|
213
|
+
lastError = "No active Cast session to end";
|
|
214
|
+
Logger.error(TAG, lastError, null);
|
|
215
|
+
latch.countDown();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
sm.endCurrentSession(true);
|
|
220
|
+
success.set(true);
|
|
221
|
+
Logger.info(TAG, "Cast session ended by request");
|
|
222
|
+
} catch (Exception e) {
|
|
223
|
+
lastError = "Error ending session: " + e.getMessage();
|
|
224
|
+
Logger.error(TAG, lastError, e);
|
|
225
|
+
} finally {
|
|
226
|
+
latch.countDown();
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
mainHandler.post(endRunnable);
|
|
231
|
+
|
|
232
|
+
try {
|
|
233
|
+
latch.await(4, TimeUnit.SECONDS);
|
|
234
|
+
} catch (InterruptedException ignored) {}
|
|
235
|
+
|
|
236
|
+
return success.get();
|
|
237
|
+
}
|
|
238
|
+
|
|
170
239
|
/**
|
|
171
240
|
* Verifica si hay dispositivos Cast disponibles mediante MediaRouter
|
|
172
241
|
*/
|
|
@@ -288,15 +357,23 @@ public class IonicChromecast {
|
|
|
288
357
|
return;
|
|
289
358
|
}
|
|
290
359
|
|
|
291
|
-
|
|
360
|
+
// Cache buster para evitar que el receiver siga mostrando el media anterior
|
|
361
|
+
String effectiveUrl = url;
|
|
362
|
+
try {
|
|
363
|
+
String suffix = (url != null && url.contains("?")) ? "&" : "?";
|
|
364
|
+
effectiveUrl = url + suffix + "_cb=" + System.currentTimeMillis();
|
|
365
|
+
} catch (Exception ignored) {}
|
|
292
366
|
|
|
293
|
-
|
|
367
|
+
Logger.info(TAG, "loadMedia: url=" + effectiveUrl + ", contentType=" + contentType);
|
|
368
|
+
|
|
369
|
+
// Use GENERIC to ensure subtitle surfaces in Cast UI overlays.
|
|
370
|
+
MediaMetadata md = new MediaMetadata(MediaMetadata.MEDIA_TYPE_GENERIC);
|
|
294
371
|
if (title != null && !title.isEmpty()) md.putString(MediaMetadata.KEY_TITLE, title);
|
|
295
372
|
if (subtitle != null && !subtitle.isEmpty()) md.putString(MediaMetadata.KEY_SUBTITLE, subtitle);
|
|
296
373
|
if (imageUrl != null && !imageUrl.isEmpty()) md.addImage(new WebImage(android.net.Uri.parse(imageUrl)));
|
|
297
374
|
|
|
298
375
|
String ct = (contentType != null && !contentType.isEmpty()) ? contentType : "video/mp4";
|
|
299
|
-
MediaInfo mediaInfo = new MediaInfo.Builder(
|
|
376
|
+
MediaInfo mediaInfo = new MediaInfo.Builder(effectiveUrl)
|
|
300
377
|
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
|
|
301
378
|
.setContentType(ct)
|
|
302
379
|
.setMetadata(md)
|
|
@@ -310,6 +387,15 @@ public class IonicChromecast {
|
|
|
310
387
|
return;
|
|
311
388
|
}
|
|
312
389
|
|
|
390
|
+
// Si la sesión es de otro appId, registra aviso pero intenta cargar igualmente
|
|
391
|
+
try {
|
|
392
|
+
String currentAppId = session.getApplicationMetadata() != null ? session.getApplicationMetadata().getApplicationId() : "";
|
|
393
|
+
String desiredAppId = CastOptionsProvider.sReceiverApplicationId;
|
|
394
|
+
if (desiredAppId != null && !desiredAppId.isEmpty() && !desiredAppId.equals(currentAppId)) {
|
|
395
|
+
Logger.warn(TAG, "Session appId=" + currentAppId + " differs from desired=" + desiredAppId + "; attempting load on current session");
|
|
396
|
+
}
|
|
397
|
+
} catch (Exception ignored) {}
|
|
398
|
+
|
|
313
399
|
try {
|
|
314
400
|
String appId = session.getApplicationMetadata() != null ? session.getApplicationMetadata().getApplicationId() : "";
|
|
315
401
|
String deviceName = session.getCastDevice() != null ? session.getCastDevice().getFriendlyName() : "";
|
|
@@ -324,6 +410,14 @@ public class IonicChromecast {
|
|
|
324
410
|
return;
|
|
325
411
|
}
|
|
326
412
|
|
|
413
|
+
// Detener lo que esté reproduciendo antes de cargar
|
|
414
|
+
try {
|
|
415
|
+
PendingResult<RemoteMediaClient.MediaChannelResult> stopPending = rmc.stop();
|
|
416
|
+
if (stopPending != null) {
|
|
417
|
+
stopPending.await(3, TimeUnit.SECONDS);
|
|
418
|
+
}
|
|
419
|
+
} catch (Exception ignored) {}
|
|
420
|
+
|
|
327
421
|
MediaLoadRequestData req = new MediaLoadRequestData.Builder()
|
|
328
422
|
.setMediaInfo(mediaInfo)
|
|
329
423
|
.setAutoplay(true)
|
|
@@ -8,6 +8,10 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
8
8
|
|
|
9
9
|
import android.text.TextUtils;
|
|
10
10
|
import com.google.android.gms.cast.CastMediaControlIntent;
|
|
11
|
+
import com.google.android.gms.cast.framework.CastSession;
|
|
12
|
+
import com.google.android.gms.cast.framework.Session;
|
|
13
|
+
import com.google.android.gms.cast.framework.SessionManager;
|
|
14
|
+
import com.google.android.gms.cast.framework.SessionManagerListener;
|
|
11
15
|
import androidx.appcompat.app.AppCompatActivity;
|
|
12
16
|
import androidx.mediarouter.app.MediaRouteChooserDialog;
|
|
13
17
|
import androidx.mediarouter.media.MediaRouteSelector;
|
|
@@ -18,6 +22,7 @@ import android.content.DialogInterface;
|
|
|
18
22
|
public class IonicChromecastPlugin extends Plugin {
|
|
19
23
|
|
|
20
24
|
private IonicChromecast implementation = new IonicChromecast();
|
|
25
|
+
private SessionManagerListener<CastSession> sessionListener;
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* Initialize the Google Cast SDK
|
|
@@ -42,12 +47,76 @@ public class IonicChromecastPlugin extends Plugin {
|
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
if (success) {
|
|
50
|
+
setupSessionListener();
|
|
45
51
|
call.resolve(ret);
|
|
46
52
|
} else {
|
|
47
53
|
call.reject("Failed to initialize Cast SDK", ret);
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
|
|
57
|
+
private void setupSessionListener() {
|
|
58
|
+
try {
|
|
59
|
+
SessionManager sm = implementation.getCastContext() != null ? implementation.getCastContext().getSessionManager() : null;
|
|
60
|
+
if (sm == null) return;
|
|
61
|
+
|
|
62
|
+
if (sessionListener == null) {
|
|
63
|
+
sessionListener = new SessionManagerListener<CastSession>() {
|
|
64
|
+
@Override public void onSessionStarting(CastSession session) {
|
|
65
|
+
JSObject data = new JSObject();
|
|
66
|
+
data.put("state", "starting");
|
|
67
|
+
notifyListeners("sessionStarted", data);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Override public void onSessionStarted(CastSession session, String sessionId) {
|
|
71
|
+
JSObject data = new JSObject();
|
|
72
|
+
data.put("state", "started");
|
|
73
|
+
data.put("sessionId", sessionId);
|
|
74
|
+
notifyListeners("sessionStarted", data);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Override public void onSessionStartFailed(CastSession session, int i) {
|
|
78
|
+
JSObject data = new JSObject();
|
|
79
|
+
data.put("state", "startFailed");
|
|
80
|
+
data.put("code", i);
|
|
81
|
+
notifyListeners("sessionEnded", data);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Override public void onSessionEnding(CastSession session) {
|
|
85
|
+
JSObject data = new JSObject();
|
|
86
|
+
data.put("state", "ending");
|
|
87
|
+
notifyListeners("sessionEnded", data);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@Override public void onSessionEnded(CastSession session, int i) {
|
|
91
|
+
JSObject data = new JSObject();
|
|
92
|
+
data.put("state", "ended");
|
|
93
|
+
data.put("code", i);
|
|
94
|
+
notifyListeners("sessionEnded", data);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@Override public void onSessionResuming(CastSession session, String s) {}
|
|
98
|
+
@Override public void onSessionResumed(CastSession session, boolean b) {}
|
|
99
|
+
@Override public void onSessionResumeFailed(CastSession session, int i) {}
|
|
100
|
+
@Override public void onSessionSuspended(CastSession session, int i) {}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
sm.removeSessionManagerListener(sessionListener, CastSession.class);
|
|
105
|
+
sm.addSessionManagerListener(sessionListener, CastSession.class);
|
|
106
|
+
} catch (Exception ignored) {}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Override
|
|
110
|
+
protected void handleOnDestroy() {
|
|
111
|
+
super.handleOnDestroy();
|
|
112
|
+
try {
|
|
113
|
+
SessionManager sm = implementation.getCastContext() != null ? implementation.getCastContext().getSessionManager() : null;
|
|
114
|
+
if (sm != null && sessionListener != null) {
|
|
115
|
+
sm.removeSessionManagerListener(sessionListener, CastSession.class);
|
|
116
|
+
}
|
|
117
|
+
} catch (Exception ignored) {}
|
|
118
|
+
}
|
|
119
|
+
|
|
51
120
|
/**
|
|
52
121
|
* Muestra el selector nativo de dispositivos Cast
|
|
53
122
|
*/
|
|
@@ -63,6 +132,17 @@ public class IonicChromecastPlugin extends Plugin {
|
|
|
63
132
|
|
|
64
133
|
getActivity().runOnUiThread(() -> {
|
|
65
134
|
try {
|
|
135
|
+
// Si hay una sesión con otro appId, termínala para forzar el receiver actual
|
|
136
|
+
try {
|
|
137
|
+
SessionManager sm = implementation.getCastContext().getSessionManager();
|
|
138
|
+
CastSession current = sm != null ? sm.getCurrentCastSession() : null;
|
|
139
|
+
String wantedApp = CastOptionsProvider.sReceiverApplicationId;
|
|
140
|
+
String currentApp = (current != null && current.getApplicationMetadata() != null) ? current.getApplicationMetadata().getApplicationId() : "";
|
|
141
|
+
if (current != null && current.isConnected() && wantedApp != null && !wantedApp.isEmpty() && !wantedApp.equals(currentApp)) {
|
|
142
|
+
sm.endCurrentSession(true);
|
|
143
|
+
}
|
|
144
|
+
} catch (Exception ignored) {}
|
|
145
|
+
|
|
66
146
|
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
|
67
147
|
String receiverId = CastOptionsProvider.sReceiverApplicationId;
|
|
68
148
|
if (TextUtils.isEmpty(receiverId)) receiverId = "CC1AD845";
|
|
@@ -131,6 +211,24 @@ public class IonicChromecastPlugin extends Plugin {
|
|
|
131
211
|
}
|
|
132
212
|
}
|
|
133
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Finaliza la sesión Cast activa
|
|
216
|
+
*/
|
|
217
|
+
@PluginMethod
|
|
218
|
+
public void endSession(PluginCall call) {
|
|
219
|
+
boolean ended = implementation.endSession();
|
|
220
|
+
JSObject ret = new JSObject();
|
|
221
|
+
ret.put("success", ended);
|
|
222
|
+
String err = implementation.getLastError();
|
|
223
|
+
if (err != null && !err.isEmpty()) ret.put("error", err);
|
|
224
|
+
|
|
225
|
+
if (ended) {
|
|
226
|
+
call.resolve(ret);
|
|
227
|
+
} else {
|
|
228
|
+
call.reject("Failed to end session", ret);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
134
232
|
/**
|
|
135
233
|
* Revisa si hay dispositivos disponibles
|
|
136
234
|
*/
|
package/dist/docs.json
CHANGED
|
@@ -93,6 +93,16 @@
|
|
|
93
93
|
],
|
|
94
94
|
"slug": "loadmedia"
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"name": "endSession",
|
|
98
|
+
"signature": "() => Promise<{ success: boolean; message?: string; }>",
|
|
99
|
+
"parameters": [],
|
|
100
|
+
"returns": "Promise<{ success: boolean; message?: string | undefined; }>",
|
|
101
|
+
"tags": [],
|
|
102
|
+
"docs": "End the current Cast session (Android only)",
|
|
103
|
+
"complexTypes": [],
|
|
104
|
+
"slug": "endsession"
|
|
105
|
+
},
|
|
96
106
|
{
|
|
97
107
|
"name": "addListener",
|
|
98
108
|
"signature": "(eventName: ChromecastEventType, listenerFunc: (event: ChromecastEvent) => void) => PluginListenerHandle",
|
|
@@ -70,6 +70,13 @@ export interface IonicChromecastPlugin {
|
|
|
70
70
|
success: boolean;
|
|
71
71
|
message?: string;
|
|
72
72
|
}>;
|
|
73
|
+
/**
|
|
74
|
+
* End the current Cast session (Android only)
|
|
75
|
+
*/
|
|
76
|
+
endSession(): Promise<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
message?: string;
|
|
79
|
+
}>;
|
|
73
80
|
/**
|
|
74
81
|
* Listen to Chromecast events (Android only)
|
|
75
82
|
*/
|
|
@@ -1 +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"]}
|
|
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 * End the current Cast session (Android only)\n */\n endSession(): 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"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -28,5 +28,9 @@ export declare class IonicChromecastWeb extends WebPlugin implements IonicChrome
|
|
|
28
28
|
success: boolean;
|
|
29
29
|
message?: string;
|
|
30
30
|
}>;
|
|
31
|
+
endSession(): Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
message?: string;
|
|
34
|
+
}>;
|
|
31
35
|
addListener(_eventName: ChromecastEventType, _listenerFunc: (event: ChromecastEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
32
36
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -25,6 +25,10 @@ export class IonicChromecastWeb extends WebPlugin {
|
|
|
25
25
|
console.warn('loadMedia() is not supported on web.');
|
|
26
26
|
return { success: false, message: 'Media casting only available on Android.' };
|
|
27
27
|
}
|
|
28
|
+
async endSession() {
|
|
29
|
+
console.warn('endSession() is not supported on web.');
|
|
30
|
+
return { success: false, message: 'Session control only available on Android.' };
|
|
31
|
+
}
|
|
28
32
|
addListener(_eventName, _listenerFunc) {
|
|
29
33
|
console.warn('addListener() is not supported on web.');
|
|
30
34
|
const handle = {
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +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,CAA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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"]}
|
|
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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,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\n async endSession(): Promise<{ success: boolean; message?: string }> {\n console.warn('endSession() is not supported on web.');\n return { success: false, message: 'Session control 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"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -32,6 +32,10 @@ class IonicChromecastWeb extends core.WebPlugin {
|
|
|
32
32
|
console.warn('loadMedia() is not supported on web.');
|
|
33
33
|
return { success: false, message: 'Media casting only available on Android.' };
|
|
34
34
|
}
|
|
35
|
+
async endSession() {
|
|
36
|
+
console.warn('endSession() is not supported on web.');
|
|
37
|
+
return { success: false, message: 'Session control only available on Android.' };
|
|
38
|
+
}
|
|
35
39
|
addListener(_eventName, _listenerFunc) {
|
|
36
40
|
console.warn('addListener() is not supported on web.');
|
|
37
41
|
const handle = {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +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,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AAQ,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;;;;;;;;;"}
|
|
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 async endSession() {\n console.warn('endSession() is not supported on web.');\n return { success: false, message: 'Session control 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,C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;AACtF,IAAI;AACJ,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC;AAC7D,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,4CAA4C,EAAE;AACxF,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
CHANGED
|
@@ -31,6 +31,10 @@ var capacitorIonicChromecast = (function (exports, core) {
|
|
|
31
31
|
console.warn('loadMedia() is not supported on web.');
|
|
32
32
|
return { success: false, message: 'Media casting only available on Android.' };
|
|
33
33
|
}
|
|
34
|
+
async endSession() {
|
|
35
|
+
console.warn('endSession() is not supported on web.');
|
|
36
|
+
return { success: false, message: 'Session control only available on Android.' };
|
|
37
|
+
}
|
|
34
38
|
addListener(_eventName, _listenerFunc) {
|
|
35
39
|
console.warn('addListener() is not supported on web.');
|
|
36
40
|
const handle = {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +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;;;;;;;;;;;;;;;"}
|
|
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 async endSession() {\n console.warn('endSession() is not supported on web.');\n return { success: false, message: 'Session control 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,QA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ionic-chromecast",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Capacitor plugin for Google Cast SDK (Chromecast) integration with Android support",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"clean": "rimraf ./dist",
|
|
52
52
|
"watch": "tsc --watch",
|
|
53
53
|
"prepublishOnly": "npm run build",
|
|
54
|
-
"android:run": "cd example-app && npm install && npx cap sync android && npx cap run android",
|
|
54
|
+
"android:run": "cd example-app && npm install && npm run build && npx cap sync android && npx cap run android",
|
|
55
55
|
"android:serve": "cd example-app && npm install && npm run dev -- --host --port 5173",
|
|
56
56
|
"android:run:live": "cd example-app && npm install && npx cap sync android && npx cap run android --livereload --external --livereload-url=http://localhost:5173"
|
|
57
57
|
},
|