tlenclos / react-native-audio-streaming

iOS & Android react native module to play an audio stream, with background support and media controls
MIT License
783 stars 254 forks source link

undefined is not an object (evaluating 'ReactNativeAudioStreaming.getStatus') #55

Open jgeurts opened 7 years ago

jgeurts commented 7 years ago

I'm trying to add the player to the sample app that react creates and am getting an exception when running iOS. I installed react-native-audio-streaming using the cocoapod technique and specified the background audio setting.

My component looks like:

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View
} from 'react-native';
import { Player } from 'react-native-audio-streaming';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
        <Player url={"http://lacavewebradio.chickenkiller.com:8000/stream.mp3"} />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

I'm very new to react-native and ios development, so I could very well be missing something trivial :)

jgeurts commented 7 years ago

Full code to reproduce this is available at https://github.com/dmbstream/mobile

tlenclos commented 7 years ago

Hi ! Could you please post also the exception ?

jgeurts commented 7 years ago

Hopefully this helps - please let me know if I can provide anything else

/Users/jgeurts/dev/meetattheshow_mobile/node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m:1:9: fatal error: 'RCTBridgeModule.h' file not found
#import "RCTBridgeModule.h"
        ^
1 error generated.

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

Check dependencies

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

Check dependencies

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

Check dependencies

=== BUILD TARGET Pods-MeetAtTheShowTests OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

** BUILD FAILED **

The following build commands failed:
    CompileC /Users/jgeurts/dev/meetattheshow_mobile/ios/build/Build/Intermediates/Pods.build/Debug-iphonesimulator/RNAudioStreaming.build/Objects-normal/x86_64/ReactNativeAudioStreaming.o /Users/jgeurts/dev/meetattheshow_mobile/node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
tlenclos commented 7 years ago

Weird, did you try the manual installation process ? https://github.com/tlenclos/react-native-audio-streaming#3-manual-installation

devvpm commented 7 years ago

I think It has to do with the JavaScript version

devvpm commented 7 years ago

@jgeurts try this react-native link react-native-audio-streaming

and then react-native run-android

jgeurts commented 7 years ago

@devvpm The link command completed successfully, but I'm getting the following now:

** BUILD FAILED **

The following build commands failed:

    CompileC /Users/jgeurts/dev/meetattheshow_mobile/ios/build/Build/Intermediates/Pods.build/Debug-iphonesimulator/RNAudioStreaming.build/Objects-normal/x86_64/ReactNativeAudioStreaming.o /Users/jgeurts/dev/meetattheshow_mobile/node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

If it makes a difference, I'm using node v6.6.0. Also, I'm not sure if it matters, but when I modified the Podfile for the iOS project, I linked to node_modules as: pod 'RNAudioStreaming', :path => '../node_modules/react-native-audio-streaming' - Notice the .. before node_modules.

devvpm commented 7 years ago

@jgeurts That worked for me in Android, Check this link for iOS. Linking Libraries - iOS

piloulac commented 7 years ago

Hi,

i wonder i have a similar issue. Indeed when i try to use ReactNativeAudioStreaming in this case:

> let songsDataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }).cloneWithRows( this.props.artist.songs );
> return(
>                 <ListView
>                     dataSource={ songsDataSource }
>                     style={ styles.songsList }
>                     renderHeader={this.renderHeaderSongList.bind(this)}
>                     renderRow={(song, sectionId, rowId) => (
>                   <TouchableHighlight onPress={ () => {
>                       this.setState({selectedSource: song.url});
>                       {ReactNativeAudioStreaming.play(song.url, {})}
>                   }}>
>                     <View key={song} style={ styles.song }>
>                       <Text style={ styles.songTitle }>
>                         { song.url }
>                       </Text>
>                       <Text style={ styles.albumTitle }>
>                         { song.album }
>                       </Text>
>                     </View>
>                   </TouchableHighlight>
>                  )}
>                 />
>             );
> 

i have the same problem with : undefined is not an object (evaluating '_reactNativeAudioStreaming.ReactNativeAudioStreaming.play')

I installed it with react native link and i followed all the instructions. Note: The link libraries that i have are: libStreamingKit.a and libPods-ReactNativeAudioStreaming.a (not libReactNativeAudioStreaming.a ). Could it be a problem?

amirrezamahyari commented 7 years ago

same problem: BUILD SUCCEEDED in console but : undefined is not an object (evaluating '_reactNativeAudioStreaming.ReactNativeAudioStreaming.play')

zerbfra commented 7 years ago

use the manual way (3rd option) to solve this

gaggi4734 commented 7 years ago

@zerbfra Nothing changed. Still getting the same error. Tried all ways of installation

ryanvoong commented 7 years ago

any updates on this? i'm getting the same error

oximer commented 7 years ago

I´m having the same issue on Android "react-native": "0.45.1",

nikolaigeorgie commented 7 years ago

The example project works. What else is different in the setup? (I'm having trouble with android)

tb9jen commented 7 years ago

I used the 2nd method for IOS and got this error too, and it was because I was unable to add lib-ReactNativeAudioStreaming.a ( I only had the option for libPods-ReactNativeAudioStreaming under Link Binary with Libraries) and I found that I needed to add ReactNativeAudioStreaming.xcodeproj under Libraries in order to have the correct option. Once I did that it ran just fine.

thngdude commented 7 years ago

@tb9jen Hey, this worked for me. So, thanks. I think many folks here are getting stuck up with the libPods-ReactNativeAudioStreaming vs lib-ReactNativeAudioStreaming.

FYI - I used install option #2.

zaouifahd commented 7 years ago

Hi, the same thing for me, someone solved this ?

twisstosin commented 6 years ago

Same issue

polp6880 commented 6 years ago

@tb9jen you saved me :) Dragging ReactNativeAudioStreaming.xcodeproj inside project did the trick. Thanks!

kostyaVyrodov commented 6 years ago

Tried all installation types and I still get same error fatal error: 'React/RCTBridgeModule.h' file not found #import <React/RCTBridgeModule.h>

arcesoj commented 6 years ago

I have the same issue ../native/React/Base/RCTBridgeModule.h:54:16: Redefinition of 'RCTMethodInfo'

polp6880 commented 6 years ago

@kostyaVyrodov @JoseArceDev - to solve that issue I had to use an older version of React Native. This is what I have in my package.json for the test I did:

"react-native": "0.47.2"