Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions GoogleCast.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export default {
castMedia: function (mediaUrl:string, title:string, imageUrl:string, seconds:number = 0) {
GoogleCast.castMedia(mediaUrl, title, imageUrl, seconds);
},
stopCast: function {
GoogleCast.stopCast();
},
seekCast: function (seconds:number) {
GoogleCast.seekCast(seconds);
},
Expand Down
9 changes: 9 additions & 0 deletions ios/RNGoogleCast/RNGoogleCast.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
static NSString *const DEVICE_AVAILABLE = @"GoogleCast:DeviceAvailable";
static NSString *const DEVICE_CONNECTED = @"GoogleCast:DeviceConnected";
static NSString *const MEDIA_LOADED = @"GoogleCast:MediaLoaded";
static NSString *const MEDIA_STOPPED = @"GoogleCast:MediaStopped";


@implementation GoogleCast
Expand All @@ -21,6 +22,7 @@ - (NSDictionary *)constantsToExport
@"DEVICE_AVAILABLE": DEVICE_AVAILABLE,
@"DEVICE_CONNECTED": DEVICE_CONNECTED,
@"MEDIA_LOADED": MEDIA_LOADED,
@"MEDIA_STOPPED":MEDIA_STOPPED,
};
}

Expand Down Expand Up @@ -113,6 +115,13 @@ - (NSDictionary *)constantsToExport
[self.mediaControlChannel seekToTimeInterval: seconds];
}

RCT_EXPORT_METHOD(stopCast){
[self.mediaControlChannel stop];

[self emitMessageToRN:MEDIA_STOPPED
:nil];
}

RCT_REMAP_METHOD(getDevices,
resolver:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject)
Expand Down