Code Monkey home page Code Monkey logo

react-native-audio-streaming-player's Introduction

Hi there ๐Ÿ‘‹

react-native-audio-streaming-player's People

Contributors

kyo504 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

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-audio-streaming-player's Issues

Linking does not work for both ios and android

1: in IOS, it can not find Player object when you import it, if I want to use play() function, it is undefined.
2: building the android crashes, saying
RNAudioPlayer/AudioPlayerService.java:172: error: cannot find symbol MediaButtonReceiver.handleIntent(mMediaSession, startIntent);

Android Audio Backgrounding

I have this audio player up and running on streaming audio but for some reason the audio stops playing when the application goes into the background. Am I supposed to do something to enabled that functionality?

Still working

@kyo504 , is this library still working?
It has so many issues open and none closed ... Did you recommend me to use this one?

Streaming Audio (Icecast) restarts from buffer on stop/pause

We are using the plugin to play an Icecast audio stream on iOS. Unfortunately stop as well as pause action doesn't stop the playback properly. It just restarts audio from the buffer (starting from the same point where the listener has tuned in). Please find the relevant part of our code starting and stopping the playback...

  playerAction(action, url) {
    if (!this.locked) {
      this.locked = true;
      if (action === 'play' && url && url !== null) {
        this.url = url.replace('https', 'http');
        const genre = url.split('http://')[1].split('.')[0];
        this.title = `${genre.charAt(0).toUpperCase()}${genre.slice(1)}`;
        console.log(`Title: ${this.title}`);
        console.log(`Play URL: ${this.url}`);
        this.onPlay();
      } else if (action === 'pause') {
        console.log('pause');
        this.onPause();
      }  else if (action === 'stop') {
        console.log('stop');
        this.onPause(); // Player.stop is very unstable...
      }
      var self = this;
      setTimeout(() => {
        self.locked = false;
        console.log('Unlocking...');
      }, 500);
    }
  }

Problem at android manifest

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:11:7-34
  	is also present at [:react-native-streaming-audio-player] AndroidManifest.xml:14:18-44 value=(true).
  	Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-24:19 to override.

Adding more functionalities

Hi Hunkyo,

I am using this package for one mobile app I am making and I am wondering if you are going to add more functionalities to this package like getDuration, read from local files for network exceptions, skipping 10sec, etc.

I already updated RNAudioPlayer file to read local files with specific key sent to it but I think it would be better if this package gets more updates as it is excellent one compared to the other RN libs/packages.

Load so slow from URL

is there a way to load my streaming URL fast ?

the player take 30 sec to load my streaming URL to listen the song.

Just blank not plays music at all

help if you can

`import React from 'react'
import {Dimensions,View,ImageBackground, DeviceEventEmitter,TouchableOpacity,Image} from "react-native"
import { Transition } from "react-navigation-fluid-transitions"
import LinearGradient from 'react-native-linear-gradient';
import PlayBar from "./music/play"
import Entypo from "react-native-vector-icons/Entypo"

import { Slider } from 'react-native-elements'
import * as Animatable from 'react-native-animatable';
import Player from 'react-native-audio-streaming-player';

export default class MusicPage extends React.Component {

constructor(props) {
super(props)
this.state = {
maxValue:0,
currentValue:0,
isPlaying:false,

}

Player.play("https://archive.org/download/testmp3testfile/mpthreetest.mp3", {
title: "test",
artist: "test",
album_art_uri: "https://i.ytimg.com/vi/y90yaLFoYoA/maxresdefault.jpg",
});

this.onPlaybackActionChanged = this.onPlaybackActionChanged.bind(this);
this.onPlaybackPositionUpdated = this.onPlaybackPositionUpdated.bind(this);
this.onPlaybackStateChanged = this.onPlaybackStateChanged.bind(this);

}

componentDidMount() {
DeviceEventEmitter.addListener('onPlaybackPositionUpdated', this.onPlaybackPositionUpdated);
DeviceEventEmitter.addListener('onPlaybackStateChanged', this.onPlaybackStateChanged);
DeviceEventEmitter.addListener('onPlaybackActionChanged', this.onPlaybackActionChanged);
}
onPlaybackPositionUpdated(event) {
console.log('Current position: ' + event.currentPosition);

if (this.state.status === 'PLAYING') {
if (!this.dragging) {
this.setState({
currentTime: parseInt(event.currentPosition), // convert milisecond to second
});
}
}
}

onPlaybackActionChanged(event) {
console.log('Current Action: ' + event.action);
}

onPlaybackStateChanged(event) {
console.log('PlaybackState: ' + event.state);
this.setState({ status: event.state });
}

render() {

return (
   <View style={{flex:1,backgroundColor:'#000'}}>
<ImageBackground blurRadius={15} style={{flex:1}} source={{uri:this.props.navigation.state.params.url}}>
<TouchableOpacity onPress={()=> {this.props.navigation.pop()}}style={{marginTop:20,marginLeft:20,width:40,height:40,borderRadius:20,backgroundColor:"rgba(0,0,0,0.5)",justifyContent:"center",alignItems:"center"}}>
  <Entypo size={20}  color="#FFF" name="chevron-thin-down" />
  </TouchableOpacity>
  
  
  
   <View style={{flex:1,alignItems:"center",justifyContent:"center"}}>
   
   {
     
     this.state.isPlaying?(
            <Transition shared="img" >

    <Animatable.Image animation="pulse" easing="ease-in-out"  useNativeDriver={true} duration={300} iterationCount="infinite" style={{ width:Dimensions.get("window").width/2,height:Dimensions.get("window").width/2,borderRadius:Dimensions.get("window").width/4}} source={{uri:this.props.navigation.state.params.url}}/>

  </Transition>
       ):(
              <Transition shared="img" >

    <Image  style={{ width:Dimensions.get("window").width/2,height:Dimensions.get("window").width/2,borderRadius:Dimensions.get("window").width/4}} source={{uri:this.props.navigation.state.params.url}}/>

  </Transition>
         
         )
     
   }


  
  
    </View>

     <View style={{flex:0.5}}>
    <LinearGradient colors={['transparent',"#000000"]} style={{flex:1}}> 
        <View style={{flex:1,justifyContent:"center"}}>
        <View style={{flexDirection:"row",justifyContent:"center"}}>
          <Slider maximumValue={this.state.maxValue} animateTransitions={true}  value={this.state.currentValue} style={{width:Dimensions.get("window").width-50}} minimumTrackTintColor="#FFF" maximumTrackTintColor="#6A6D70"  
         />
 
        </View>
          <View style={{height:100}}>
             <PlayBar onPlay={() => soundObject.playAsync() } onPause={() => soundObject.pauseAsync()} isPlaying={this.state.isPlaying}/>
          </View>
           
        </View>
        </LinearGradient>  
    </View>
   
    
   </ImageBackground>
     
   
    
   </View>
  )

}
}
`

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.