indiecastfm / react-native-audio-streamer Goto Github PK
View Code? Open in Web Editor NEWA react-native audio streaming module which works on both iOS & Android
License: MIT License
A react-native audio streaming module which works on both iOS & Android
License: MIT License
Hi,
Looks like currentTime and duration features not working, they return 0. The duration method crash application.
Also would be great to know how to stop the audio?
Tested on
RN 32.1
Android and iOS platforms
Audio cache is non-disablable feature, that wouldn`t be usefull for streaming apps, but its take really a lot of memory on the devices.
My current issue is that the currentTime is moving, however if I run it against a normal clock it is much slower. Actually it seems that when the player run 5 seconds, in "real life" it has been 15 seconds.
I am running a setInterval every 1 second to update the screen and show the current time however I am not sure what is going on.
I'm getting daily reports from users of my app (getlucid.com) that the audio cuts out intermittently and may or may not work after an app restart.
Has anyone experienced anything similar? Is this library being maintained or is there a different/better RN audio streaming solution out there?
Thanks!
Hi! I get undefined is not an object (evaluating '_reactNativeAudioStreamer2.defaiult.setUrl')
I should note that I am a total noob at react native.
running react native 0.47.2 og mac os
Hey so, if my main React Native application is cleared up by Android for memory, the service also stops. This kinda sucks because it means if they're listening to a song, it ends mid-way. I've tried as much as I can to lower the memory footprint of my app, but if I'm doing heavy browsing on multiple apps in the foreground, Android cleans it up.
Any idea how to tweak the code to keep the RNAudioStreamer service alive and avoid Android from killing it when it clears up memory from the main activity? I've been looking into:
Both might be helpful, but not sure where I'd throw those into the code...
Hi, first of all thanks for your great work =)
My issue:
when i start streaming an audio file the file is playing for 5/10s (it depends).
I try to share the audio file to WhatsApp to be sure thats its not a file problem and its working perfectly when the audio file are playing on WhatsApp.
Do you have any idea why this behaviour occurs?
Thks
"react-native-audio-streamer": "0.0.7"
I follow the simple example with IOS, but it's working.
Does it need any configuration?
Hello,
Is there any way to automatically stop any other app playing (i.e Spotify) when this player starts ?
Thank you
Why does not this simple example play me?
"react": "16.0.0-alpha.12",
"react-native": "0.47.0",
Step 1
npm install react-native-audio-streamer --save
Step 2
react-native link react-native-audio-streamer
My source:
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Button,
View
} from 'react-native'
import RNAudioStreamer from 'react-native-audio-streamer'
RNAudioStreamer.setUrl('http://lacavewebradio.chickenkiller.com:8000/stream.mp3')
export default class Stream extends Component {
onPressPlay() {
RNAudioStreamer.play()
}
render() {
RNAudioStreamer.status((err, status)=>{
if(!err) console.log(status)
})
return (
<View style={styles.container}>
<Button
onPress={this.onPressPlay}
title="PLAY"
color="blue"
/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
})
AppRegistry.registerComponent('Stream', () => Stream)
Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-audio-streamer] AndroidManifest.xml:12:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:7:5-24:19 to override.
Just got this working, I love how easy it was to setup and how minimal it is so that I can design my own player around it. However, the sound is terrible and I just want to make sure it's not something wrong with how I've set things up.
I'm running my app in Genymotion and I suspect that is the cause of the issue but I just want to be sure.
e: yeah the problem was related to emulation. switched to device debugging and it sounds amazing! excellent work. I'll leave this up and close it just in case anyone has this issue as well.
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Button,
View
} from 'react-native'
import RNAudioStreamer from 'react-native-audio-streamer'
RNAudioStreamer.setUrl('http://lacavewebradio.chickenkiller.com:8000/stream.mp3')
export default class Stream extends Component {
onPressPlay() {
RNAudioStreamer.play()
}
render() {
RNAudioStreamer.status((err, status)=>{
if(!err) console.log(status)
})
return (
<View style={styles.container}>
<Button
onPress={this.onPressPlay}
title="PLAY"
color="blue"
/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
})
undefined is not an object (evaluating '_reactNativeAudioStreamer2.default.setUrl')
I've noticed that if my network goes wonky or I lose signal, the songs get all messed up. They often stop halfway through. I've tried the following:
This doesn't really seem to be that effective. Wondering what your thoughts are around this?
Also noticed that you guys are working in a much newer branch -- any plans to merge that into master?
I'm try to use this package in React Native version 0.48.4 and always have this error in iOS redefinition of 'RCTMethodInfo'
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:13:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
In file included from /Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:13:
/Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:54:16: error: redefinition of 'RCTMethodInfo'
typedef struct RCTMethodInfo {
^
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:9:
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.h:10:
../../react-native/React/Base/RCTBridgeModule.h:54:16: note: previous definition is here
typedef struct RCTMethodInfo {
^
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:13:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
In file included from /Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:13:
/Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:58:3: error: typedef redefinition with different types ('struct (anonymous struct at /Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:54:16)' vs 'struct RCTMethodInfo')
} RCTMethodInfo;
^
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:9:
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.h:10:
../../react-native/React/Base/RCTBridgeModule.h:58:3: note: previous definition is here
} RCTMethodInfo;
^
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:13:
In file included from ../../react-native/React/Base/RCTEventDispatcher.h:12:
In file included from /Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridge.h:13:
/Users/luciano/Library/Developer/Xcode/DerivedData/minutosDeSabedoria-azkedynizuzbsvfbgkbuwmswzege/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:65:11: warning: duplicate protocol definition of 'RCTBridgeModule' is ignored [-Wduplicate-protocol]
@protocol RCTBridgeModule <NSObject>
^
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:9:
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.h:10:
../../react-native/React/Base/RCTBridgeModule.h:65:11: note: previous definition is here
@protocol RCTBridgeModule <NSObject>
^
/Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:108:34: warning: 'sendDeviceEventWithName:body:' is deprecated: Subclass RCTEventEmitter instead [-Wdeprecated-declarations]
[self.bridge.eventDispatcher sendDeviceEventWithName:@"RNAudioStreamerStatusChanged"
^
In file included from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.m:13:
../../react-native/React/Base/RCTEventDispatcher.h:84:1: note: 'sendDeviceEventWithName:body:' has been explicitly marked deprecated here
__deprecated_msg("Subclass RCTEventEmitter instead");
^
In module 'Foundation' imported from /Users/luciano/apps/App2Sales/minutosDeSabedoria/node_modules/react-native-audio-streamer/ios/RNAudioStreamer/RNAudioStreamer.h:9:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/sys/cdefs.h:180:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
^
2 warnings and 2 errors generated.
I created a fresh react native app and after react-native link react-native-audio-streamer
build failed both in Xcode and react native cli.
Some advice to fix this problem?
Hello!
I faced with this issue after installing your module, please help me figure out.
The err looks this way:
ReferenceError: DEV is not defined (While processing preset: "/Users/roman/Work/TheUpperRoom/node_modules/react-native/Libraries/react-native/react-native.js")
at Object. (/Users/roman/Work/TheUpperRoom/node_modules/react-native/Libraries/react-native/react-native.js:15:5)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /Users/roman/Work/TheUpperRoom/node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:302:17
at Array.map (native)
TransformError: /Users/roman/Work/TheUpperRoom/node_modules/react-native-audio-streamer/index.js: DEV is not defined (While processing preset: "/Users/roman/Work/TheUpperRoom/node_modules/react-native/Libraries/react-native/react-native.js")
Hey Victor, been building a React Native audio app for a little while now, and every library I've bumped into struggles with background streaming + control (eg, playing next song while in background; lock screen controls).
Have you put any thought into these functions?
React-Native Audio Streamer is wonderful! Is it possible to change the playback speed?
Hi :)
i'm trying to do a progress bar that use the percentage, so i need the duration and the currenti time. But i'm using a while loop that is not working, anyone can help?
_statusChanged(status) {
console.log(status);
RNAudioStreamer.duration((err, duration)=>{
if(!err){
console.log(duration);
this.setState({duration: duration});
} //seconds
})
while(status === 'PLAYING'){
RNAudioStreamer.currentTime((err, currentTime)=>{
if(!err){
console.log(currentTime);
this.setState({currentTime: currentTime});
}//seconds
})
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.