Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-native-google-cast

React Native wrapper for the Google Cast SDK for iOS and Android

react-native, ios, android, chromecast, google, cast, google-cast

readme

npm version

react-native-google-cast

This library wraps the native Google Cast SDK for Android and iOS (and maybe web/Chrome in the future), providing a unified JavaScript interface.

It is written in TypeScript so types will always be up-to-date.

Version History

RNGC React Native iOS Android Maintained Notes
1.x 🤷‍♂️ 🤷‍♂️ 🤷‍♂️ 🛑 Old version implemented for Google Cast SDK v2 with manual discoverability.
3.x >=0.40 🤷‍♂️ 🤷‍♂️ 🛑 Rewrite of the library for Google Cast SDK v3 with automatic session management.
4.x >=0.60 10+ | 🐜 Completely rewritten API, closely resembling native Android/iOS APIs.

Documentation

https://react-native-google-cast.github.io/docs/getting-started/installation

Example

Refer to the example folder to find a React Native version of the CastVideos reference app.

Playground

Refer to the playground folder to find a sample app demonstrating the available APIs provided by the library.

Expo

This library can by used by custom built Expo apps (not Expo Go) since Expo SDK 42. The config plugin is now included in this project. Follow Installation and Setup sections of the docs.

Troubleshooting

See Troubleshooting in the docs.

Contribution

  1. Read CONTRIBUTING.md
  2. Fork the repo
  3. Implement your shiny new thing
  4. Demonstrate how to use it in the playground project
  5. Document the functionality in JSDoc and the docs
  6. Create a pull request

changelog

4.8.3 (2024-09-11)

Features

  • enable expanded controller in Expo [close #538] (b385ad1)

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

4.8.3

  • added namespace for AGP version 7+ #536
  • feat: enable expanded controller in Expo [close #538] #538
  • docs: fix iosStartDiscoveryAfterFirstTapOnCastButton default value 545e898

4.8.2

14 July 2024

  • fix(expo): use internal expo plugin & docs(expo): updated docs & chore: fixed testsuite and linting #522
  • Remove jcenter #471
  • fix: example project setup [close #504] #504
  • chore: release 4.8.2 389b78e

4.8.1

26 June 2024

  • chore: simplify iOS SDK dependency 47256b5
  • chore: release 4.8.1 822cbac

4.8.0

20 February 2024

  • Fix crash in fromGCKColor #517
  • Fix RCTConvert+GCKImage crash #516
  • feat: add liveSeekableRange object to MediaStatus #493
  • fix: prevent crash when ending session due to missing GMS #496
  • [android] Don't send an error in onSessionEnded when user stops casting #481
  • chore: refactor 17f925a
  • chore: release 4.8.0 4d18f14
  • feat: expose requestStatus method d474f1f

4.7.0

8 February 2024

  • chore: use official CocoaPods ARM variants c5d114a
  • chore: release 4.7.0 3a24312
  • link to official support 4a2a129

4.6.2

15 January 2023

  • chore: release 4.6.2 9cd8483
  • fix: prevent crash when no session available #477 9901ade

4.6.1

4 January 2023

4.6.0

26 November 2022

  • fix: check for nulls [close #454] #454
  • chore: copy expo plugin 833d8b1
  • chore: release 4.6.0 83b97cf
  • chore: default to arm-compatible pod 2a46e59

4.5.0

25 September 2022

  • feat: cast channel state and info [close #449] #449
  • bug template 3b084fa
  • chore: release 4.5.0 b64f40f
  • fix: crash reading notification options #447 41cca84

4.4.1

13 August 2022

4.4.0

9 August 2022

  • feat: handle missing play services 85d722c
  • chore: release 4.4.0 50ef7c9

4.3.0

31 July 2022

  • chore: support Arm Macs & RN upgrade 1558f3f
  • chore: release 4.3.0 5b279f5

4.2.8

6 July 2022

  • chore: release 4.2.8 9fba8b3
  • fix(ios): added null fallback to adBreakClipInfo dictionary 6fe9d87

4.2.7

29 June 2022

  • fix: update missing path, following podspec move #439
  • fix: update missing path, following podspec move (#439) #438
  • chore: release 4.2.7 7c05cc5
  • docs: m1 beta installation dfd88e7
  • chore: clean up redundancy 1af23b0

4.2.6

26 June 2022

4.2.5

25 June 2022

  • fix: podspec location [close #438] #438
  • chore: release 4.2.5 6242d28
  • docs: troubleshooting unsupported devices ee3428c

4.2.4

13 March 2022

  • fix (example): call mergeOptions when mounted 1c0017c
  • chore: release 4.2.4 f82434c
  • fix (android): filter duplicate devices #375 0c332c7

4.2.3

11 March 2022

  • fix: resolve requests [close #296] #296
  • chore: release 4.2.3 4b3fde6
  • docs: set tintColor 86eae55
  • docs: showCastDialog limitations a5231aa

4.2.2

7 March 2022

4.2.1

6 March 2022

  • Added device capability array to Device #396
  • chore: release 4.2.1 e9e601b

4.2.0

27 February 2022

  • fix: mediaInfo can be null [close #327] #327
  • fix (android): CastButton init [close #352] #352
  • chore: update dependencies 7f9d066
  • feat: ignoreBackgrounding for useCastSession 4644b3e
  • chore: release 4.2.0 f85f694

4.1.3

26 February 2022

  • fix: prevent crash when GooglePlay services is missing or running on Android TV #367
  • Fix color parsing [close #350] #350
  • chore: release 4.1.3 4647572
  • docs: using Expo, Android 12, and iOS 12+ 7f9a8eb
  • fix: required authors field 75d6161

4.1.2

24 June 2021

  • fix: run startDiscovery and stopDiscovery on the iOS main thread #340
  • feat: implement session setMute and setVolume c4e55fb
  • chore: release 4.1.2 ee21864

4.1.1

22 June 2021

  • fix: invalidate compat with RN <=63 [close #339] #339
  • docs: provide a full usage example 60e1324
  • chore: release 4.1.1 5bb04a5
  • docs: update castFrameworkVersion f2fd82b

4.1.0

20 June 2021

  • hslSegmentFormat and hlsVideoSegmentFormat android support #323
  • Fix CastButton tintColor on Android #335
  • Fix example #320
  • feat: manage devices and sessions [close #306] #306
  • fix: use relative imports [close #318] #318
  • chore: update dependencies 5c16fc6
  • chore: release 4.1.0 a33dab1
  • feat: hlsSegmentFormat for ios #278 332b507

4.0.3

27 March 2021

  • Fixes clearing behavior in setProgressUpdateInterval #313
  • Link ios as static_framework #312
  • chore: release 4.0.3 46d656a

4.0.2

26 February 2021

  • fix JS not getting events if expanded controls are open in Android #300
  • Android: support the case that multiple CastButtons are rendered #299
  • fix: Crash on iOS when using SessionManager events and reloading #285
  • Fix linker warnings from iOS react-native-google-cast #293
  • docs: improve setup instructions 5a447b4
  • chore: release 4.0.2 89f0895

4.0.1

27 January 2021

  • fix: setActiveMediaTracks [close #280] #280
  • fix: xcodeproj file references [close #281] #281
  • fix: set active media tracks #277 a43a7fd
  • chore: release 4.0.1 bfee08e
  • fix: check for invalid default values 706faa3

4.0.0

3 January 2021

  • feat: media events; close #257 #257
  • feat: end session; close #241 #241
  • docs: swift instructions; close #212 #212
  • feat: custom channels; close #223 #165 #223
  • chore: update dependencies f455cea
  • feat: discovery manager #221 3c3be54
  • feat: android notification buttons #252 d193613

4.0.0-beta.6

15 December 2020

  • fix: play and pause on Android V4 #250
  • fix: client already removed; fixes #251 #251
  • chore: release 4.0.0-beta.6 ca56a24

4.0.0-beta.5

14 December 2020

  • feat: media status event; closes #237 #237
  • fix: cast state listener; close #243 #243
  • fix: check for null values; closes #232 #232
  • docs: clarify installation & setup #240 9d59be6
  • chore: release 4.0.0-beta.5 3ba476f
  • fix: times in seconds [Android] #244 64c483b

4.0.0-beta.4

27 November 2020

  • chore: release 4.0.0-beta.4 6c19fec
  • docs: ios installation & queue fc8e40c

4.0.0-beta.3

27 November 2020

  • Added queueSkip and queuePrev to manage media queue #236
  • chore: release 4.0.0-beta.3 21c7ba8

4.0.0-beta.2

24 November 2020

  • fix: #233 Adding items to queue 7af4baa
  • chore: release 4.0.0-beta.2 1f23b44

4.0.0-beta.1

31 October 2020

  • Properly point to podspec #217
  • build: set up bob c2af14a
  • feat(sdk): latest SDK updates 2e61c53
  • Update example project using the new APIs 77024e8

3.4.1

12 December 2020

  • Migrate the podspec file to root #245
  • Version 3.4.1 aba40b8

3.4.0

3 November 2020

  • Enable latest iOS SDK versions, closes #221 #221
  • Fix #226 crash when imageUrl undefined #226
  • Version 3.4.0 313a94f
  • Initialize Google Cast lib before React bridge f89405e

3.3.0

16 February 2020

  • Add toggleSubtitles method for iOS #176
  • Bump sshpk from 1.13.1 to 1.16.1 #156
  • Update docs for toggleSubtitles 3ac665f
  • Version 3.3.0 71dae0b
  • docs: add missing imports for custom apps 3017304

3.2.2

13 November 2019

3.2.1

29 October 2019

  • [feat][Android] Add ability to show subtitles and style them #127
  • [feat] Adding typescript type definitions #128
  • Add showCastPicker method to show the cast picker dialog without… #149
  • Constrain play-services-cast-framework version to 16.2.0 #121
  • Fix iOS SDK dependency, upgrade example to 0.59.10 625c638
  • Add protection for not update-to-date or missing google play services ec143cd
  • [bug][Android] More NPE protection for casting operations 9474a46

3.1.2

30 April 2019

  • corrected README for Android setup #99
  • feat: Can pass customData to receiver #96
  • Docs: add required step for iOS 12 setup (enable wifi access) #82
  • Add proper search path to fix the issue #51 where GoogleCast.h cannot be found #84
  • [Android] initChannel and sendMessage #90
  • [iOS] Fix #75 tintColor #75
  • Installation instructions c051eef
  • Fix custom messages + sample receiver 850ad0f
  • Add getCastDevice 9074a79

3.0.5

24 January 2019

  • Added missing Cast Button to Androids Expanded Media Controller #78
  • Version 3.0.5 715605f

3.0.4

15 January 2019

  • Add optional contentType config to castMedia() #73
  • Media Progress Listener 90a35d1
  • Log progress update in example app fcc1cc0
  • Fix Android castMedia parameters 3487dc2

3.0.3

11 January 2019

3.0.2

11 January 2019

  • Instructions for custom receiver app on Android 3cc8d4b
  • Version 3.0.2 b68cd03

3.0.1

11 January 2019

  • V3 #71
  • V3 #70
  • Update example project to RN 0.55.4 #14
  • Changed podfile example to version "2.10.4.1" #38
  • Support for specific app id. #29
  • reorganize example project dependencies and files 548f0d5
  • Support React Native 0.57 beb6a68
  • upgraded sdk for iOS to v3 7b4b829

1.3.1

11 January 2019

1.3.0

9 April 2017

  • Fix bug when two chromecast devices are connected #27
  • compatibility with RN 0.40+ #24
  • moved array declaration inside loop to avoid same referencing to fix … #17
  • upgraded example and module version 265d770
  • added example inside the project 0d699fc
  • using react-native-library as a template 1643813

0.1.0

1 July 2016

0.0.1

13 June 2016