Code Monkey home page Code Monkey logo

react-native-google-cast's People

Contributors

amauryliet avatar armands-malejevs avatar cbargren avatar charliesbot avatar codetony25 avatar cristi-lupu avatar dependabot[bot] avatar dracoblue avatar evanbacon avatar eymaddis avatar henninghall avatar jacob-israel-turner avatar minishlink avatar nbennink avatar neoassyrian avatar niteshbhardwaj avatar petrbela avatar rmccue avatar sjors98 avatar sufianbabri avatar tomas-lejdung avatar uyt95 avatar vmseba avatar wildseansy avatar yvbeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-google-cast's Issues

Example doesn't list chromecasts

Hi, I'm having problems getting the library to list available devices. When I run the example, it shows that chromecasts are around, but when I press the 'Show chromecasts' button nothing happens.

I've debugged the issues a fair a bit and it seems that the onCastDeviceDetected function is never called. It randomly seems to work once and then stops working indefinitely.

undefined is not an object (evaluating 'GoogleCast.DEVICE_CHANGED')

I get the following error. I have tested on simulator and on device.

undefined is not an object (evaluating 'GoogleCast.DEVICE_CHANGED')

<unknown>
    GoogleCast.js:36
loadModuleImplementation
    require.js:122
guardedLoadModule
    require.js:65
_require
    require.js:49
<unknown>
    index.ios.js:16
loadModuleImplementation
    require.js:122
guardedLoadModule
    require.js:58
_require
    require.js:49
global code
    require-0.js:1

[Android] 0 Devices

I'm getting the right devices on the iOS end, just not Android. They share the same class for both so I don't think its on my end. I'm listening to the DEVICE_AVAILABLE event then calling getDevices() right after and I'm getting the "devices size 0" log.

I tried polling every few seconds regardless of the event and still nothing.

I see the chromecast device when I open the Chromecast app, and I can see it from the iOS device immediately before/after I test on Android. Also double checked that I'm on the same network.

Snippet of my RN code:

    async function getDevices() {
      let devices = await Chromecast.getDevices();

      console.log('[GoogleCastModule] New Devices', devices);

      myThis.chromecasts = devices;
      myThis.sendUpdatedList();
    }

    // Available Device
    DeviceEventEmitter.addListener(Chromecast.DEVICE_AVAILABLE, function(data) {
      getDevices();
    });

I see 0 devices on the java log so I don't think this snippet is very helpful

Problem compiling react-native-google-cast

Hello,

I'm trying to compile the react-native-google-cast and when my react native application tries to do this I get:

 problem occurred configuring project ':react-native-google-cast'.
   > Could not resolve all dependencies for configuration ':react-native-google-cast:_debugCompile'.
      > Could not find com.google.android.gms:play-services-cast:9.0.0.

Any tip?

error scanning on Android

this error when trying to Chromecast.startScan()

Could not invoke RNGoogleCast.startScan

null

com.google.android.gms.cast.LaunchOptions
invoke
    JavaMethodWrapper.java:374
invoke
    JavaModuleWrapper.java:166
run
    NativeRunnable.java
handleCallback
    Handler.java:739
dispatchMessage
    Handler.java:95
dispatchMessage
    MessageQueueThreadHandler.java:31
loop
    Looper.java:148
run
    MessageQueueThreadImpl.java:194
run
    Thread.java:818

already add the compile lines to bundle.gradle

dependencies {
    compile project(':react-native-google-cast')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile 'com.google.android.gms:play-services-cast:9.4.0'
    compile 'com.android.support:mediarouter-v7:23.0.1'
    compile "com.facebook.react:react-native:+"  // From node_modules
}
"dependencies": {
		"react": "16.0.0-alpha.12",
		"react-native": "0.46.1",
		"react-native-google-cast": "git+https://github.com/charliesbox/react-native-google-cast.git#fix-chromecast-android"
	},

DASH/HLS support

Are there plans to support the Google Cast library's adaptive streaming options like HLS or DASH? Looks like it's currently hardcoded to use video/mp4, and it causes a generic failure screen on the Chromecast device when I attempt to use an MPD or M3U8 playlist. If not, would you be open to a PR?

Build Fails - No Delegate set : lost message:Done

I am getting the following error when trying to build after following the instructions. Same errors occur when I try using the example application.

I get a long list of errors some of which are the following. Let me know if you can help. Thanks.

AAPT out(1063813574) : No Delegate set : lost message:Done
AAPT: C:\Users\mfs78\Desktop\reactnative\CastHelloText-chrome-master\example\node_modules\react-native-google-cast\android\build\intermediates\exploded-aar\com.google.android.libraries.cast.companionlibrary\ccl\2.8.4\res\drawable-xhdpi-v11\ic_stat_action_democast.png ERROR: Unable to open PNG file

Chromecast.startScan(); is not working

I am trying to scan chrome cast but it's not working...

import Chromecast from 'react-native-google-cast'; Chromecast.startScan();

When i run the app it doesnt scan and when i turn off mobile screen and turn on they check for devices then i am getting devices. And while doing turn off and turn on... it is firing onCastAvailabilityChange event. Why and How?

Tests?

How about a basic test harness?

iOS build fails with: 'GoogleCast/GoogleCast.h' file not found

Hello, I recently had this library start failing to build on iOS when included in my project. I have tried reinstalling, relinking, etc.

I have tried both 'google-cast-sdk', '2.10.4.1' and 'google-cast-sdk' in my podfile. I've tried manually adding the $(SRCROOT)/../node_modules/react-native-google-cast/ios path to the header search paths in Build Settings, and I even tried to manually add the GoogleCast.h and GoogleCast.m files into my project as mentioned in issue #21.

I also cloned a fresh copy of the repo from here and tried the example project in both the master branch and 1.3.0 branch. In every single one of these circumstances I get the following error:

/Users/chris/Desktop/react-native-google-cast/ios/GoogleCast.h:2:9: fatal error: 'GoogleCast/GoogleCast.h' file not found
#import <GoogleCast/GoogleCast.h>
        ^
1 error generated.

Any more ideas to try? I'm running out... Thanks!

npm install error: "peerinvalid Peer [email protected] wants react-native@^0.29.0"

When trying to install with npm, in a project with a recent version of React Native, I'm getting this error:

npm ERR! peerinvalid Peer react-native-google-cast@1.0.0 wants react-native@^0.29.0

It appears that both the master branch and the latest features/new-functions branch include these outdated references:

package.json:

"peerDependencies": {
    "react-native": "^0.29.0"

build.gradle:

dependencies {
    ...
    compile 'com.facebook.react:react-native:0.20.+'

Can these be updated to the latest version?

unable to run ios app

"react": "15.4.2",
"react-native": "0.42.3",
"react-native-google-cast": "^1.2.0",

pod install run with success and installed 1 Package.

calling run-ios leads to following error message:

...

=== BUILD TARGET GoogleCast OF PROJECT GoogleCast WITH CONFIGURATION Debug ===


Check dependencies



CompileC /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/Objects-normal/x86_64/GoogleCast.o GoogleCast.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/benny/.nvm/versions/node/v4.4.3/bin:./node_modules/.bin/:/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql55/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/benny/Library/Android/sdk/tools:/Users/benny/Library/Android/sdk/platform-tools"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=7.0 -g -Wno-sign-conversion -Wno-infinite-recursion -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/GoogleCast-generated-files.hmap -I/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/GoogleCast-own-target-headers.hmap -I/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/GoogleCast-all-target-headers.hmap -iquote /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/GoogleCast-project-headers.hmap -I/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include -I/Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/../node_modules/react-native/React -I../../react-native/React -I../../react-native/React/Base -I../../react-native/React/CxxBridge -I../../react-native/React/CxxModule -I../../react-native/React/CxxUtils -I../../react-native/React/Executors -I../../react-native/React/Modules -I../../react-native/React/Profiler -I../../react-native/React/Views -I../../../ios -I../../../ios/AwesomeProject -I../../../ios/AwesomeProject-tvOS -I../../../ios/AwesomeProject-tvOSTests -I../../../ios/AwesomeProject.xcworkspace -I../../../ios/AwesomeProjectTests -I../../../ios/Pods -I../../../ios/build -I../../../ios/Pods/Headers -I../../../ios/Pods/Local\ Podspecs -I../../../ios/Pods/Target\ Support\ Files -I../../../ios/Pods/google-cast-sdk -I../../../ios/build/Build -I../../../ios/build/Logs -I../../../ios/Pods/Headers/Public -I../../../ios/Pods/Target\ Support\ Files/Pods-AwesomeProject -I../../../ios/Pods/Target\ Support\ Files/Pods-AwesomeProject-tvOSTests -I../../../ios/Pods/Target\ Support\ Files/Pods-AwesomeProjectTests -I../../../ios/Pods/google-cast-sdk/GoogleCastSDK-Public-3.3.0-Release -I../../../ios/build/Logs/Build -I../../../ios/Pods/Headers/Public/google-cast-sdk -I../../../ios/Pods/Headers/Public/google-cast-sdk/GoogleCast -I/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/DerivedSources/x86_64 -I/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/DerivedSources -F/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator -MMD -MT dependencies -MF /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/Objects-normal/x86_64/GoogleCast.d --serialize-diagnostics /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/Objects-normal/x86_64/GoogleCast.dia -c /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m -o /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/Objects-normal/x86_64/GoogleCast.o

In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
In file included from ../../react-native/React/Base/RCTBridge.h:13:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:55:11: warning: duplicate protocol definition of 'RCTBridgeModule' is ignored
@protocol RCTBridgeModule <NSObject>
          ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:1:
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.h:1:
../../react-native/React/Base/RCTBridgeModule.h:55:11: note: previous definition is here
@protocol RCTBridgeModule <NSObject>
          ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:66:1: error: duplicate interface definition for class 'RCTBridge'
@interface RCTBridge : NSObject <RCTInvalidating>
^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:66:12: note: previous definition is here
@interface RCTBridge : NSObject <RCTInvalidating>
           ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:155:55: error: property has a previous declaration
@property (nonatomic, copy, readonly) NSArray<Class> *moduleClasses;
                                                      ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:155:55: note: property declared here
@property (nonatomic, copy, readonly) NSArray<Class> *moduleClasses;
                                                      ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:160:48: error: property has a previous declaration
@property (nonatomic, strong, readonly) NSURL *bundleURL;
                                               ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:160:48: note: property declared here
@property (nonatomic, strong, readonly) NSURL *bundleURL;
                                               ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:166:37: error: property has a previous declaration
@property (nonatomic, strong) Class executorClass;
                                    ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:166:37: note: property declared here
@property (nonatomic, strong) Class executorClass;
                                    ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:171:61: error: property has a previous declaration
@property (nonatomic, weak, readonly) id<RCTBridgeDelegate> delegate;
                                                            ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:171:61: note: property declared here
@property (nonatomic, weak, readonly) id<RCTBridgeDelegate> delegate;
                                                            ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:176:53: error: property has a previous declaration
@property (nonatomic, copy, readonly) NSDictionary *launchOptions;
                                                    ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:176:53: note: property declared here
@property (nonatomic, copy, readonly) NSDictionary *launchOptions;
                                                    ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:181:56: error: property has a previous declaration
@property (nonatomic, readonly, getter=isLoading) BOOL loading;
                                                       ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:181:56: note: property declared here
@property (nonatomic, readonly, getter=isLoading) BOOL loading;
                                                       ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:186:54: error: property has a previous declaration
@property (nonatomic, readonly, getter=isValid) BOOL valid;
                                                     ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:186:54: note: property declared here
@property (nonatomic, readonly, getter=isValid) BOOL valid;
                                                     ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:191:50: error: property has a previous declaration
@property (nonatomic, readonly, weak) JSContext *jsContext;
                                                 ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:191:50: note: property declared here
@property (nonatomic, readonly, weak) JSContext *jsContext;

      ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
/Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:196:63: error: property has a previous declaration
@property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger;
                                                              ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:3:
../../react-native/React/Base/RCTBridge.h:196:63: note: property declared here
@property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger;
                                                              ^
/Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:218:32: warning: 'sendAppEventWithName:body:' is deprecated: Subclass RCTEventEmitter instead [-Wdeprecated-declarations]
  [self.bridge.eventDispatcher sendAppEventWithName: eventName
                               ^
In file included from /Volumes/DEV/workspaces/react-native/AwesomeProject/node_modules/react-native-google-cast/ios/GoogleCast.m:4:
../../react-native/React/Base/RCTEventDispatcher.h:77:1: note: 'sendAppEventWithName:body:' has been explicitly marked deprecated here
- (void)sendAppEventWithName:(NSString *)name body:(id)body
^
2 warnings and 10 errors generated.



** BUILD FAILED **


The following build commands failed:

	CompileC /Volumes/DEV/workspaces/react-native/AwesomeProject/ios/build/Build/Intermediates/GoogleCast.build/Debug-iphonesimulator/GoogleCast.build/Objects-normal/x86_64/GoogleCast.o GoogleCast.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

How to cast Live stream to Chromecast

Hi,

Thanks for the great library, How to cast live streams to Chromecast, i am getting CORS error when i try to cast youtube channel live stream

Thanks

App can't cast video from 2nd times.

App.js:

`'use strict';

import React, {
Component
} from 'react';
import {
Text,
View,
Dimensions,
Navigator,
StatusBar,
AsyncStorage,
BackAndroid,
ActivityIndicator,
InteractionManager,
TouchableOpacity,
Image,
} from 'react-native';

import Chromecast from 'react-native-google-cast';

class App extends Component {

constructor(props) {
super(props);
showChromecast: false,
}
}

componentDidMount() {
this.getUserInfo().done();
Chromecast.startScan();
DeviceEventEmitter.addListener(Chromecast.DEVICE_AVAILABLE, (existance) => this.setState({chromecastAround: existance.device_available}));
}

render() {
return (

{ (this.state.showChromecast && this.state.chromecastAround) && <ChromecastList {...this.state} handleShowChromecast={this.handleShowChromecast}
handleConnectedChromecast={this.handleConnectedChromecast} setChromecastId={this.setChromecastId} /> }

);
}

renderScene = (route, navigator) => {
let component = null;

switch (route.id) {
  case 1:
    const route1 = AppRoutes.getRouteFromRouteId(1);
    component = <Detail ref={route1.refView} navigator={navigator} handlePlayerClose={this.handlePlayerClose} navigate={this.navigate} {...route} isLogin={this.state.isLogin} {...this.state}
                        fullscreenPlayer={this.fullscreenPlayer} />
    break;
  default:
      component = <Home ref={route1.refView} navigator={navigator} navigate={this.navigate} {...this.state} />
      break;
}

return (
  <View style={styles.container} onLayout={this._onLayout}>
    {component}
  </View>
);

}

_onLayout = (e) => {
const {width, height} = e.nativeEvent.layout;

const _layout = appLayoutAndroid(e.nativeEvent.layout);
this.setState(_layout);

}
}

export default App;
`

Detail.js:

`import React, {Component} from 'react';
import {
View,
Text,
Image,
TouchableWithoutFeedback,
TouchableOpacity,
Dimensions,
ActivityIndicator,
Animated,
Easing,
AsyncStorage,
Alert,
Navigator,
DeviceEventEmitter,
AppState,
InteractionManager
} from 'react-native';
import styles from '../../styles/Style';
import Video from 'react-native-video';
import {Progress, ProgressChromecast, ProgressLive} from '../../components';
import Chromecast from "react-native-google-cast";
import {CachedImage} from "react-native-img-cache";
import { Icon } from 'react-native-elements';

let FORWARD_DURATION = 7;
let currentChromecastTime = 0;

Navigator.NavigationBar.Styles = {backgroundColor: 'transparent'}

export default class PlayerVideo extends Component {

constructor(props) {
super(props);

this.chromecastCastMedia = this.chromecastCastMedia.bind(this);
this.onVideoLoad = this.onVideoLoad.bind(this);
this.onVideoEnd = this.onVideoEnd.bind(this);
this.onProgress = this.onProgress.bind(this);
this.onProgressChanged = this.onProgressChanged.bind(this);
this.updateProgressChanged = this.updateProgressChanged.bind(this);
this.playOrPauseVideo = this.playOrPauseVideo.bind(this);
this.playOrPauseChromecastVideo = this.playOrPauseChromecastVideo.bind(this);
this.resizeModeControl = this.resizeModeControl.bind(this);
//this.connectToChromecast = this.connectToChromecast.bind(this);
this.onBuffer = this.onBuffer.bind(this);

this.state = ({
  appState: AppState.currentState,
  rate: 1.0,
  volume: 1.0,
  muted: false,
  paused: false,
  pausedChromecast: false,
  duration: 0.0,
  currentTime: 0.0,
  isToggle: false,
  dataVideo: [],
  dataRelate: [],
  selectedTab: 'information',
  imageLoading: true,
  linkVideo: '',
  linkKaraoke: false,
  listDetail: null,
  key: new Date(),
  hideProgress: false,
  clicked: false,
  isBuffering: false,
  isBuffering: false,
  isKaraoke: false,
  currentTimeKara: 0,
  isChangeLink: false,
  playVideoEnd: false,
  loading: false,
});

}

componentDidMount() {
const {receiveDetail, dataDetail, data, passProps, idChild, isLogin} = this.props;

InteractionManager.runAfterInteractions(() => {
  this.setState({loading: true});

  if(parseInt(idChild) > 0) {
    receiveDetail(idChild);
  } else {
    (passProps && passProps.timelines) && dataDetail(passProps.timelines.content);
  }
});

//this.props.chromecastId && this.resetChromecast(this.props.chromecastId);
DeviceEventEmitter.addListener(Chromecast.MEDIA_LOADED, () => { console.log(3333333) });
DeviceEventEmitter.addListener(Chromecast.DEVICE_CONNECTED, () => {this.chromecastCastMedia()});

}

closeAudio = () => {
const {handlePlayerClose} = this.props;
handlePlayerClose();
}

async connectToChromecast(id) {
const isConnected = await Chromecast.isConnected();
isConnected ? this.chromecastCastMedia() : Chromecast.connectToDevice(id);
}

resetChromecast(id) {
this.connectToChromecast(id).done();
}

componentWillReceiveProps(nextProps) {
nextProps.chromecastId && this.connectToChromecast(nextProps.chromecastId);
}

componentWillUnmount() {
if(this.timeout) {
clearTimeout(this.timeout);
}
AppState.removeEventListener('change', this._handleAppStateChange);
}

onVideoEnd() {
this.setState({paused: true, playVideoEnd: true});
}

onVideoLoad(e) {
this.setState({
duration: !this.props.isLogin ? 0.0 : e.duration,
//duration: e.duration,
currentTime: e.currentTime,
imageLoading: false
});

setTimeout(() => {
  this.setState({hideProgress: true});
}, 8000)

}

onProgress(e) {
this.setState({
currentTime: e.currentTime,
imageLoading: false
});
}

getCurrentTimePercentage(currentTime, duration) {
if (parseFloat(this.state.currentTime) > 0 && parseFloat(this.state.duration) > 0) {
return parseFloat(currentTime) / parseFloat(duration);
} else {
return 0;
}
}

onProgressChanged(newPercent, paused) {
let {duration} = this.state;
let newTime = newPercent * duration / 100;

if(newTime <= 0) {
  newTime = 0;
}

if(newTime > duration) {
  newTime = duration;
}

this.setState({currentTime: newTime, paused: paused});
this.videoPlayer.seek(newTime);

}

playOrPauseVideo() {
if(!this.props.isLogin) {
this.showMessageIfNotLoggedIn();
} else {
if(this.state.paused && this.state.playVideoEnd) {
this.videoPlayer.seek(0);
}
this.setState({paused: !this.state.paused, playVideoEnd: false});
}
//this.setState({paused: !this.state.paused});
}

playOrPauseChromecastVideo() {
if(!this.props.isLogin) {
this.showMessageIfNotLoggedIn();
} else {
Chromecast.togglePauseCast();
this.setState({pausedChromecast: !this.state.pausedChromecast})
}
// Chromecast.togglePauseCast();
// this.setState({pausedChromecast: !this.state.pausedChromecast})
}

displayProgress() {
this.setState({hideProgress: false, isToggle: false});

if(this.timeout) {
    clearTimeout(this.timeout);
}

this.timeout = setTimeout(() => {
  this.setState({hideProgress: true});
}, 8000);

}

chromecastCastMedia() {
const { listDetail } = this.props.data;
Chromecast.castMedia(listDetail.content.link, listDetail.content.name, listDetail.content.image, 0);
}

resizeModeControl() {
const {fullscreenPlayer, width, height} = this.props;
let fullscreen = '';

Orientation.getOrientation(function(err, orientation) {
    if(err) { return console.log('Error rotate') }

    if(orientation === 'LANDSCAPE') {
      Orientation.lockToPortrait();
      fullscreen = false;
    } else {
      Orientation.lockToLandscape();
      fullscreen = true;
    }

    fullscreenPlayer({
      fullscreen: fullscreen,
      width: height,
      height: width
    })
});

}

updateProgressChanged() {
const {currentTime} = this.props;
this.setState({paused: false, pausedChromecast: true});
currentTime > 0 && this.videoPlayer.seek(currentTime);
}

onBuffer({ isBuffering }: { isBuffering: boolean }) {
this.setState({ isBuffering });
}

render() {
let {data, resizeMode, width, height, fullscreen, isLogin, showChromecast} = this.props;

let {
    currentTime, duration, paused, dataVideo, volume, hideProgress, isToggle,
    pausedChromecast, isChangeLink, loading} = this.state;

let backgroundVideo = !fullscreen ? styles.backgroundVideo : styles.backgroundVideoFull;
let backgroundHeightVideo = !fullscreen ? {height: width/16*9} : {height: height};
let link = '';
let iconPlayOrPause = paused ? 'play' : 'pause';
let isTimeline = false;

link = data.listDetail.content.link;

let paddingTop = fullscreen ? 0 : 64;

return (
  (!loading || data.listDetail == null) ?
    <View style={[styles.centering, styles.waiting]}><ActivityIndicator size="small" color="white" /></View>
  :
    <View style={[styles.container, {marginTop: paddingTop}]}>
      <TouchableWithoutFeedback onPress={() => this.displayProgress()}>
            <View style={[backgroundVideo, backgroundHeightVideo]}>
              {
                  !showChromecast &&
                    <View style={[backgroundVideo, backgroundHeightVideo]}>
                      <Video source={{uri: link, mainVer: 1, patchVer: 0}}
                      ref={videoPlayer => this.videoPlayer = videoPlayer}
                      rate={this.state.rate}                     // 0 is paused, 1 is normal.
                      volume={Math.max(Math.min(1, volume), 0)}                  // 0 is muted, 1 is normal.
                      muted={false}                  // Mutes the audio entirely.
                      paused={paused}                // Pauses playback entirely.
                      resizeMode={resizeMode}            // Fill the whole screen at aspect ratio.
                      repeat={false}                  // Repeat forever.
                      progressUpdateInterval={250.0} // [iOS] Interval to fire onProgress (default to ~250ms)
                      onLoadStart={this.loadStart}   // Callback when video starts to load
                      onLoad={this.onVideoLoad}
                      onProgress={this.onProgress}      // Callback every ~250ms with currentTime
                      onEnd={this.onVideoEnd}            // Callback when playback finishes
                      onError={this.videoError}      // Callback when video cannot be loaded
                      onTimedMetadata={this.onTimedMetadata}
                      onBuffer={this.onBuffer}
                      playInBackground={false}
                      style={[backgroundVideo, backgroundHeightVideo]}
                      />
                        
                      <Progress isLive={data.listDetail.content.isLive} categoryId={data.listDetail.content.cat_id}
                      paused={paused} isLogin={isLogin}
                      playOrPauseVideo={this.playOrPauseVideo}
                      widthLayout={width} heightLayout={height}
                      changeLinkKaraoke={this.changeLinkKaraoke} link={link}
                      resizeModeControl={this.resizeModeControl}
                      duration={duration} currentTime={currentTime}
                      percent={flexCompleted} remain={flexRemaining}
                      onNewPercent={this.onProgressChanged.bind(this)}
                      fullscreen={fullscreen}
                      onInfo={this.onInfo}
                      isTimeline={isTimeline}
                      hideProgress={hideProgress} />
                       
              }
             {
               showChromecast &&
                <View style={[backgroundVideo, backgroundHeightVideo]}>
                   <ProgressChromecast isLive={data.listDetail.content.isLive} categoryId={dataVideo.cat_id}
                    widthLayout={width} heightLayout={height}
                     paused={pausedChromecast} isLogin={isLogin}
                     playOrPauseVideo={this.playOrPauseChromecastVideo}
                     changeLinkKaraoke={this.changeLinkKaraoke} link={link}
                     resizeModeControl={this.resizeModeControl}
                     duration={duration} currentTime={currentTime}
                     percent={flexCompleted} remain={flexRemaining}
                     onNewPercent={this.onProgressChanged.bind(this)}
                     onInfo={this.onInfo}
                     hideProgress={hideProgress} />
                 </View>
               }
             </View>
        </TouchableWithoutFeedback>

    </View>
)

}
}
`

When the application cast video for the first time, it cast video successfully. But the second time or more it can not cast video. Does my code have a problem?

App terminates when trying to Chromecast.connectToDevice(id)

Hi,

Just been trying to set this up and get it working, but I've taken your example class and whenever it get's to the point of connecting to device Chromecast.connectToDevice(id) the app just terminates with the following message:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'GCKCastContext has not been created yet with +[setSharedInstanceWithOptions:]'

Any thoughts?

Getting :react-native-google-cast:processReleaseResources FAILED

When attempting to run on android this is the error message i'm getting when typing in react-native run-android:

:react-native-google-cast:processReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-google-cast:processReleaseResources'.
> at index 4

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 27.844 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.

Everything is running perfectly fine on on iOS, but not android. Is this a known issue?

Can't build on Android SDK 26

Getting this error when trying to run app on Android:

src/native/node_modules/react-native-google-cast/android/src/main/java/com/googlecast/GoogleCastPackage.java:29: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error
:react-native-google-cast:compileReleaseJavaWithJavac FAILED

App works fine on iOS.

I have this versions in my build.gradle:

compileSdkVersion 26
buildToolsVersion "26.0.2"
minSdkVersion 16
targetSdkVersion 23

Custom messages

Would love a feature of casting a custom message to a custom app, with a set namespace!

Android app crash

Im getting hundreds of such error reports in the Bugsnag console

java.lang.NullPointerExceptioncom.google.android.gms.common.zzg.isGooglePlayServicesAvailable:-1

Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference

Unknown:-1com.google.android.gms.common.zzg.isGooglePlayServicesAvailable
Unknown:-1com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
VideoCastManager.java:238com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.initialize
GoogleCastModule.java:215com.googlecast.GoogleCastModule$3.run
Handler.java:739android.os.Handler.handleCallback
Handler.java:95android.os.Handler.dispatchMessage
Looper.java:135android.os.Looper.loop
ActivityThread.java:5343android.app.ActivityThread.main
Method.java:-2java.lang.reflect.Method.invoke
Method.java:372java.lang.reflect.Method.invoke
ZygoteInit.java:905com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
ZygoteInit.java:700com.android.internal.os.ZygoteInit.main

Any idea what it can be? May-be some kind of Google Play Services version incompatibility? Any suggestions how to fix that?

Support for sessions

It would be great to be able to use sessions - so that it's possible to connect to any current session.

Bug with multiple Casts (getDevices)

I'm getting a list with multiple instances of the same Chromecast when calling getDevices. The reason for this seems to be that the singleDevice variable is the same reference for all casts - move it inside the loop and it should be fine!

RCT_REMAP_METHOD(getDevices,
                 resolver:(RCTPromiseResolveBlock)resolve
                 reject:(RCTPromiseRejectBlock)reject)
{
  NSMutableArray *devicesList = [[NSMutableArray alloc] init];
  NSMutableDictionary *singleDevice= [[NSMutableDictionary alloc] init]; //Should be inside array :)
  for (NSString *key in [self.currentDevices allKeys]) {
    GCKDevice *device = self.currentDevices[key];
    singleDevice[@"id"] = key;
    singleDevice[@"name"] = device.friendlyName;
    [devicesList addObject:singleDevice];
  }
  resolve(devicesList);
}

iOS app crash on connectToDevice

app crashes when try to connectToDeivce

<Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'GCKCastContext has not been created yet with +[setSharedInstanceWithOptions:]'
	*** First throw call stack:
	(
		0   CoreFoundation                      0x000000010fdb6c65 __exceptionPreprocess + 165
		1   libobjc.A.dylib                     0x000000010fa5ebb7 objc_exception_throw + 45
		2   CoreFoundation                      0x000000010fdb6b9d +[NSException raise:format:] + 205
		3   GoogleCast                          0x000000010da5ced2 +[GCKCastContext sharedInstance] + 55
		4   GoogleCast                          0x000000010da861af -[GCKDeviceAuthChannel initWithDevice:] + 294
		5   GoogleCast                          0x000000010da62e99 -[GCKCastDeviceConnector createDeviceAuthChannelForDevice:] + 69
		6   GoogleCast                          0x000000010da63fee -[GCKCastDeviceConnector castSocket:didConnectWithPeerSecTrust:] + 105
		7   GoogleCast                          0x000000010da7d1b2 __50-[GCKCastSocket notifyDidConnectWithPeerSecTrust:]_block_invoke + 82
		8   libdispatch.dylib                   0x00000001111adf16 _dispatch_call_block_and_release + 12
		9   libdispatch.dylib                   0x00000001111c8964 _dispatch_client_callout + 8
		10  libdispatch.dylib                   0x00000001111b3a59 _dispatch_main_queue_callback_4CF + 704
		11  CoreFoundation                      0x000000010fd1e1f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
		12  CoreFoundation                      0x000000010fcdfdcb __CFRunLoopRun + 2043
		13  CoreFoundation                      0x000000010fcdf366 CFRunLoopRunSpecific + 470
		14  GraphicsServices                    0x0000000111eada3e GSEventRunModal + 161
		15  UIKit                               0x000000010e792900 UIApplicationMain + 1282
	)
Jul 21 14:12:58 Note224 com.apple.CoreSimulator.SimDevice.77E6DB02-478D-436C-B1B8-E4744CE45B38.launchd_sim[53839] (UIKitApplication:org.reactjs.native.example.[0x28c7][54976]) <Notice>: Service exited due to signal: Abort trap: 6
Jul 21 14:12:58 Note224.attlocal.net SpringBoard[53853] <Warning>: Application 'UIKitApplication:org.reactjs.native.example.[0x28c7]' crashed.
Jul 21 14:12:58 Note224 assertiond[53857] <Error>: assertion failed: 16F73 12F70: assertiond + 12334 [8E465C14-E4AE-36E9-AFBE-D28459602962]: 0x1
Jul 21 14:12:58 Note224 Unknown[53857] <Error>:

iOS 8.3 simulator

"dependencies": {
    "react": "16.0.0-alpha.12",
    "react-native": "0.46.1",
    "react-native-google-cast": "git+https://github.com/charliesbox/react-native-google-cast.git#fix-chromecast-android",
},

Example app not finding chromecasts on android

The example app builds and runs on android with no errors but when I search for devices it doesn't find any.

Weirdly it will find only one of my two chromecasts if another app (e.g. netflix) is open and connected to it or has just been connected to it. As soon as I close the other app the example app won't find any chromecasts again.

I made no changes to the example app just cloned and ran it.

Do you have any idea what might cause this?

I should also say that I get no errors in the app or with remote debugging.

Does this work in the emulator?

Hey,

Are there any known issues getting this to run properly in the Android emulator?

The problem that I'm seeing is that "ChromeCast.DEVICE_AVAILABLE" event doesn't seem to be emitted, as my callback is never executed.

On the emulator I'm able to hit my router by IP, so I would think that it would find devices. However, I'm not able to see if it's the emulator because I don't own an Android device.

Here's the code I have:

import React, {Component} from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    DeviceEventEmitter
} from 'react-native';

import Chromecast from 'react-native-google-cast';


DeviceEventEmitter.addListener(Chromecast.DEVICE_AVAILABLE, () => {
    console.log('hit'); // *** This is not being called ***
});

Chromecast.startScan();
console.log('starting scan');

Thanks!

Support for channels

Hi,

It'd be great to have support for channels to send and receive custom messages to the receiver.
Here are the links to relevant documentation: Android, iOS.

Any plans for supporting this?

iOS error: GoogleCast/GoogleCast.h file not found

Currently running React Native v0.38. We also noticed that this error was happening with 0.35.

After linking and rerunning the build for iOS in Xcode, we receive an error message that GoogleCast/GoogleCast.h file is not found. We have installed the google-cast-sdk Pod from Cocoapods & added it to our Podfile as described in the readme. We are running the build from the workspace created by Cocoapods. Any help with this issue would be greatly appreciated, we're really excited to try out your module and thought your Medium post describing it was awesome!

cc @kkemple

googlecast_h_and_kkemple_mls-work-laptop-kkemple____documents_projects_mls_bulbasaur

Failed to crunch

Error:com.android.builder.internal.aapt.AaptException: Failed to crunch file node_modules\react-native-google-cast\android\build\intermediates\exploded-aar\com.google.android.libraries.cast.companionlibrary\ccl\2.8.4\res\drawable-hdpi\ic_closed_caption_grey600_48dp.png into node_modules\react-native-google-cast\android\build\intermediates\res\merged\androidTest\debug\drawable-hdpi\ic_closed_caption_grey600_48dp.png

I'm getting a "Failed to crunch" when running the Gradle build; is there any way I can hotfix this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.