Code Monkey home page Code Monkey logo

react-soundplayer's Introduction

npm version Download Count Buy Me A Coffee

Create highly-customizable SoundCloud (or any audio) players with React.js.

Install

npm install react-soundplayer --save

Examples

There are several examples on the website. Here is the basic one to get you started:

import React from 'react';
import ReactDOM from 'react-dom';
import { PlayButton, Timer } from 'react-soundplayer/components';
import { withSoundCloudAudio } from 'react-soundplayer/addons';

const clientId = 'YOUR CLIENT ID';
const resolveUrl = 'https://soundcloud.com/ksmtk/chronemics';

const Player = withSoundCloudAudio(props => {
    let { track, currentTime } = props;

    return (
      <div className="custom-player">
        <PlayButton
          className="custom-player-btn"
          onPlayClick={() => {
            console.log('play button clicked!');
          }}
          {...props} />
        <h2 className="custom-player-title">
          {track ? track.title : 'Loading...'}
        </h2>
        <Timer 
          className="custom-player-timer"
          duration={track ? track.duration / 1000 : 0} 
          currentTime={currentTime} 
          {...props} />
      </div>
    );
});

const App = () => {
  return (
    <Player
      clientId={clientId}
      resolveUrl={resolveUrl}
      onReady={() => console.log('track is loaded!')} />
  );
};

ReactDOM.render(
  <App />, 
  document.getElementById('#app')
);

Custom Audio Example

It is also easy to built players without using SoundCloud API. You just need to pass audio source via streamUrl and all other necessary track meta information can be passed as custom props. Also you can choose preloadType, according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#Attributes, by default this property is equal to 'auto'.

import React from 'react';
import ReactDOM from 'react-dom';
import { PlayButton, Timer } from 'react-soundplayer/components';

// it's just an alias for `withSoundCloudAudio` but makes code clearer
import { withCustomAudio } from 'react-soundplayer/addons';

// audio source
const streamUrl = 'https://example.org/path/to/file.mp3';

// some track meta information
const trackTitle = 'Great song by random artist';

const AWSSoundPlayer = withCustomAudio(props => {
  const { trackTitle } = props;

  return (
    <div>
      <PlayButton {...props} />
      <h2>{trackTitle}</h2>
      <Timer {...props} />
    </div>
  );
});

class App extends React.Component {
  render() {
    return (
      <AWSSoundPlayer
        streamUrl={streamUrl}
        trackTitle={trackTitle} 
        preloadType="auto" />
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

References


MIT Licensed

react-soundplayer's People

Contributors

baka101 avatar cjpete avatar dependabot[bot] avatar dnlsandiego avatar gpoulet avatar jiku avatar joewestcott avatar mc0 avatar sbauch avatar sbrichardson avatar voronianski avatar vvitto 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-soundplayer's Issues

Going past SoundCloud

Not that I think SoundCloud is going anywhere, despite their funding issues, but it'd be cool to have some options. A self-hosted Web Audio solution to begin with. I guess it really should be at soundblogs/web-audio, soundblogs/soundcloud-audio, etc? As sources. I'm sure all this is already on your radar somewhere, but just thought I'd open an issue here. Maybe there could be a soundblogs base repo, just for overarall project ideas like these?

Consider adding a `engines` property in package.json

Might want to consider adding a "engines": { "node": NODE_VERSION_RANGE } in the package.json of the project. I was working on a PR locally earlier and I experienced some trouble installing the dependencies mainly because of package-lock.json and I suspect it was because I did not have the compatible node version.

Move SoundPlayerContainer (and possible HOC) to separate module

Let's try to make from react-soundplayer a set of tools to build react based audio players and NOT ONLY react soundcloud players. In order to achive this we need to separate concerns:

  • leave only common components in this library (Buttons, Icons, Progress, Timer, Cover etc.)
  • move container to separate modules (it can be called as react-soundplayer-addons and contain different helper containers like SoundCloudContainer or SpotifyContainer etc. or to move every service to separate addon like react-soundplayer-soundcloud-addon or react-soundplayer-spotify-addon.

examples npm start error

Error: Cannot find module 'react' from '/Users/lzz/Documents/projects/learning/react-soundplayer/examples'

Missing VolumeControl Component

I just clean install this package, but when I:
import { PlayButton, Progress, VolumeControl, Icons } from 'react-soundplayer/components';
It yields error missing VolumeControl. I watched the folder module/lib/component, and ya, it's missing this component...

Progress bar not updating

Having the same issue as #20 but no solution so far. The progress bar is just at max 100% instead of starting a 0 and progressing along with the song playing. No errors in the console as well. I'm probably just missing a proper usage of the component but I'm going along with the docs.

I made a repo to reproduce this issue: react-soundplayer-progress-component-issue

A quick glance on the code in the repo:

import React from 'react';
import ReactDOM from 'react-dom';
import { PlayButton, Progress } from 'react-soundplayer/components';
import { SoundPlayerContainer } from 'react-soundplayer/addons';

const clientId = 'xxx';
const resolveUrl = 'https://soundcloud.com/xxx/josh-j-all-i-know';

class AppPlayer extends React.Component {
    render() {

        let { track, currentTime, duration } = this.props; // These are all undefined for some reason.

        return (
            <SoundPlayerContainer resolveUrl={resolveUrl} clientId={clientId}>
                <PlayButton />
                <Progress 
                    value={currentTime / duration * 100 || 0}
                    soundcloudAudio={this.props.soundcloudAudio}
                    {...this.props}
                />
            </SoundPlayerContainer>
        )
    }
}

ReactDOM.render(
    <AppPlayer />,
    document.querySelector('.app')
);

Another issue I'm having is that the track, currentTime and duration props are all undefined.

Next Button Not Working Properly

I am not sure whats going on with my playlist player, I keep getting:
NextButton.js:56 Uncaught ReferenceError: e is not defined

The next button changes the song but is not properly changing the "is-active" class of the song. But if I click on a song then click previous button it works as expected.

I attached my main.js file where I have the playlist player code, which come from React Static BoilerPlate. I am not sure what is going on.


import 'babel-polyfill';
import 'whatwg-fetch';
import ClassNames from 'classnames';
import React, { PropTypes, Component } from 'react';
import ReactDOM from 'react-dom';
import FastClick from 'fastclick';
import { Provider } from 'react-redux';

import store from './core/store';
import router from './core/router';
import history from './core/history';
let routes = require('./routes.json'); // Loaded with utils/routes-loader.js
const container = document.getElementById('container');
import { PlayButton, PrevButton, NextButton, Progress, Icons, Timer } from 'react-soundplayer/components';
import { SoundPlayerContainer } from 'react-soundplayer/addons';

function renderComponent(component) {
  ReactDOM.render(<Provider store={store}>{component}</Provider>, container);
}

function render(location) {
  router.resolve(routes, location)
    .then(renderComponent)
    .catch(error => router.resolve(routes, { ...location, error }).then(renderComponent));
}


history.listen(render);
render(history.getCurrentLocation());

FastClick.attach(document.body);


if (module.hot) {
  module.hot.accept('./routes.json', () => {
    routes = require('./routes.json'); // eslint-disable-line global-require
    render(history.getCurrentLocation());
  });
}

const clientId = '358b0fa53153c2425022d97d00261118';
const resolveUrl = 'https://soundcloud.com/pcmus/sets/deep-trouble';


class Player extends Component {
    constructor() {
        super();

        this.state = {
            activeIndex: 0
        };
    }

    playTrackAtIndex(playlistIndex) {
        let { soundCloudAudio } = this.props;
        this.setState({activeIndex: playlistIndex});
        soundCloudAudio.play({ playlistIndex });
    }

    nextIndex() {
        let { activeIndex } = this.state;
        let { playlist } = this.props;
        if (activeIndex >= playlist.tracks.length - 1) {
            return;
        }
        if (activeIndex || activeIndex === 0) {
            this.setState({activeIndex: ++activeIndex});
        }
    }

    prevIndex() {
        let { activeIndex } = this.state;
        if (activeIndex <= 0) {
            return;
        }
        if (activeIndex || activeIndex === 0) {
            this.setState({activeIndex: --activeIndex});
        }
    }

    renderTrackList(e) {
        let { playlist } = this.props;

        if (!playlist) {
            return <div>Loading...</div>;
        }

        let tracks = playlist.tracks.map((track, i) => {
            let classNames = ClassNames('flex button button-transparent', {
                'is-active': this.state.activeIndex === i
            });

            return (
                <button
                    key={track.id}
                    className={classNames}
                    onClick={this.playTrackAtIndex.bind(this, i)}
                >
                <img src="http://vignette3.wikia.nocookie.net/logopedia/images/d/d5/ITunes_12.2_Apple_Music.png/revision/latest?cb=20150701064004" />

                    <div className="title ">{track.title}</div>
                    <br/>
                      <br/>
                    <div className="song">{track.user.username}</div>
                </button>
            );
        });

        return (
            <div>{tracks}</div>
        );
    }

    render() {
        let { playlist, currentTime, duration } = this.props;

        return (
          <div>
          <div className="control-container">
                <div className='controls'>
                <PrevButton
                    className="backward"
                    onPrevClick={this.prevIndex.bind(this)}
                    {...this.props}
                />
                <PlayButton
                    className="play flex-none h2 button button-transparent button-grow rounded"
                    {...this.props}
                />
                <NextButton
                    className="forward"
                    onNextClick={this.nextIndex.bind(this)}
                    {...this.props}
                />

              </div>
            </div>
            <div className='info'>
               {this.renderTrackList()}
          </div>

            <div className="ipod-container">
              <div id='ipod'>
                  <div id='circle' className="center-center">
                      <div id='play-pause-button'></div>
                      <div id='play-pause-button-shadow-mask'></div>
                  </div>
                  <div id='housing' className="center-center">
                      <div id='left-bezel'>
                      </div>
                      <div id='right-bezel'>
                      </div>
                  </div>
                  <div id='buttons'>
                      <div id='button1'></div>
                      <div id='button2'></div>
                  </div>
                  <div id='shadows'>
                      <div id='shadow1'></div>
                      <div id='shadow2'></div>
                      <div id='shadow3'></div>
                  </div>
              </div>
              </div>

</div>


        );
    }
}

class SCPlay extends Component {
    render() {
        return (
            <SoundPlayerContainer    clientId={clientId}
                    resolveUrl={resolveUrl}>
                <Player />
            </SoundPlayerContainer>
        );
    }
};


ReactDOM.render(<SCPlay />, document.getElementById('app'));

SoundPlayerContainer Not Displaying Iframe

Hi, I would love to get some help. Below is my code and nothing renders. There is also no errors in the console. I took the example directly from the example page. Any ideas why this wouldn't be rendering? I absolutely love the look of some of your sc players and would really love to use this!

`import React from 'react';
import { SoundPlayerContainer } from 'react-soundplayer/addons';
const clientId = 'MY_CLIENT_ID';
const resolveUrl = 'https://soundcloud.com/thrilljockey/future-islands-balance';

export default class Widget extends React.Component {
constructor(){
super();
this.trackReady = this.trackReady.bind(this);
}

trackReady(){
console.log('Track can be played!')
// Enable the play button, or start playing programmatically, etc
}

render() {
return (





)
}
}`

I also noticed that the onReady never fires.

Fleshing out getting started section?

I'm really stuck even trying to get the demos for this sorted. Is there any way you could do add more details like a step-by-step introduction on how to properly set this up on something like on a local MAMP set up?

Thanks,

Osu

How umount (or pause) component after change page or call a action?

I'm developing a custom player and /play is a custom route and render a soundcloud component.
But on change URL, click back or hide the app the soundplayer stills playing the song, even by setting the sound to null onDidUnmount action.

I can programmatically invoke an action to stop the player?

  componentWillUnmount: function() {
    this.setState({song:''}); //need to stop the player calling a action here
  },

  render: function() {
    var track = this.state.song;
    var currentTime = 0;
    var client = SOUNDCLOUD_ID;

    return (
      <div key="div_playSong">
        <div className="image" style={{ margin: '2em auto', width: '50%' }}>
          <img src={this.state.song.artwork_url} />
        </div>

        <h1>
          Musica:
          {this.state.song.title}
        </h1>
         <SoundPlayerContainer streamUrl={this.state.song.stream_url} clientId={client}>
<PlayButton className="flex-none h4 mr2 button button-transparent button-grow rounded" {...this.props} />
                <h2 className="h5 nowrap caps flex-auto m0">{track ? track.title : 'Loading...'}</h2>
<Timer className="h6 mr1" duration={track ? track.duration / 1000 : 0} currentTime={currentTime} {...this.props} />
         </SoundPlayerContainer>
      </div>
    );
  }

"pause" and "end" events are tied to the same callback function?

In SoundPlayerContainer.js line 62 and 63:

    soundCloudAudio.on('pause', this.onAudioEnded.bind(this));
    soundCloudAudio.on('ended', this.onAudioEnded.bind(this));

And then on line 116 to 121

onAudioEnded() {
    const { onStopTrack } = this.props;
    this.setState({playing: false});

    onStopTrack && onStopTrack(this.soundCloudAudio);
}

I'm trying to use the "onStopTrack" method to do something when the song ends. However, it also gets called every time the song is paused. Plus, It gets called twice when the song ends...

Instead of tying 'paused' and 'ended' both to onAudioEnded, should there be an onAudioPaused method?

Cant stop the Audio going unless click on the PLAY/STOP button

Hi,

First of all, thank You for the amazing work, it has been a pleasure to Use the SoundPlayer. However we faced a big issue. We have a menu, which toggles content in the main view. For Each content a different audio is attached. It is not starting automatically, only if the user clicks on it.

Something like this:

react_player_bug

Start and Stop of the audio is working fine. Trouble hits when the audio is playing, and the user changes menu without stopping the audio. This way the graphic re-renders and updates, but the audio is still playing.

When we do return (<p> SHOULD STOP AND CHANGE NOW! </p>) the player does not stop.

Our code:

import React from "react";
import PropTypes from "prop-types";
import { PlayButton, Timer, Progress } from "react-soundplayer/components";
import { withSoundCloudAudio } from "react-soundplayer/addons";

const AWSSoundPlayer = withSoundCloudAudio(props => {
  if (!props.stopping){
  return (
    <div className={props.playing ? "player playerplay" : "player"}>
       <PlayButton {...props} className="player__button" />
      {props.playing ? (
        <div className="player">
          <Progress {...props} className="player__progress" />
          <Timer {...props} className="player__timer" />
        </div>
      ) : (
        <div className="audio__text">Lyssna på avsnittet som ljudbok.</div>
      )}
    </div>
  )} else {
    console.log(props)
    return (<p> SHOULD STOP AND CHANGE NOW! </p>)
  }
});

class Audio extends React.Component {
  state = { change: false}
  componentWillReceiveProps(next){
    if (this.props.audioURL !== next.audioURL){
      this.setState({ change: true});
      setTimeout(() => { this.setState({ change: false}) },500)
    }
  }
  render(){
    return (
      <div id="player" className="audio">
      <AWSSoundPlayer
        key={this.props.audioURL}
        streamUrl={this.props.audioURL}
        preloadType="metadata"
        stopping={this.state.change}
      />
    </div>
    )
  }
}

export default Audio;

Audio.propTypes = {
  audioURL: PropTypes.string
};
`

A sample ionic app using react

I would like to develop a ionic using react still having problem where to start. Can you please advice how do i proceed ?

Update demo site

All changes in API and module design should be reflected on demo site.

Continue reading playlist after track's end

Hello,

Congratulations for your job ! Integration with my web site was relatively simple.

However, when a track is finish, the player doesn't read the next track. Is it normal ? How can I do that ?

Best regards,

Update peer dependencies to to avoid errors

Hi, would it be possible to update the React peer dependencies? I'm using it with React 15.2.1 and, it's working fine. The only slight thing I had to change was having to pass soundCloudAudio props to <Timer />.

Thanks!

Missing ./lib when installing from GitHub repository

When installing with
npm install --save soundblogs/react-soundplayer

I get
Error: Cannot find module './lib/components'

It seems as though the ./lib directory is not present. It would be useful to install via this method to try out my own fork(s) of the project.

Preventing default click events

Using provided PlayButton, NextButton etc. components, I end up being unable to prevent default click events, without hacking the lib's source code. So, if I, for instance, integrate the react-soundplayer in a form, any click is submitting it, which is not, by any means, a desirable behaviour.
From my perspective, it seems like react-soundplayer should run e.preventDefault() on any of it's controls.

RELEASE NEW MAJOR VERSION

Main goals

  • make sure it works with latest React version
  • update docs with all new features from RC that are not documented yet
  • fix style issues on example page (e.g. volume control)
  • fix css lint update
  • check bug issues
  • add block who's using
  • add non-soundcloud audio example

Can i use raw MP3 with this library ?

Hi, what if i don't want to play a soundcloud link - instead i have served mp3 on my server.
is this possible with this library or is this the wrong repo

thx !

cover.css breaks with webpack

Importing cover.css throws cover.css:6 Uncaught Error: Cannot find module "./"(…)

The url('') is trying to resolve a module.

odd bug only fires on small screens

Hello,

This is a bit weird. I'm getting the following error when I use a phone emulator in chrome, or set my browser width to be less than a portrait ipad.

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the undefined component.warning 
@ app.js:5993getInternalInstanceReadyForUpdate 
@ app.js:34208enqueueSetState 
@ app.js:34355ReactComponent.setState 
@ app.js:25656(anonymous function) 
@ app.js:18936(anonymous function) 
@ app.js:38955window.(anonymous function) 
@ app.js:38969(anonymous function) 
@ 33207269.json?callback=jsonp_callback_1469618094176556&client_id=e9b0084…:1

which points to
// componentDidMount

var _this = this;

var soundCloudAudio = this.soundCloudAudio;
var _props = this.props;
var resolveUrl = _props.resolveUrl;
var streamUrl = _props.streamUrl;

if (streamUrl) {
    soundCloudAudio.preload(streamUrl);
} else if (resolveUrl) {
    soundCloudAudio.resolve(resolveUrl, function (data) {
       /* THIS LINE */
        _this.setState(_defineProperty({}, data.tracks ? 'playlist' : 'track', data));
    });
}

// https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
soundCloudAudio.on('playing', this.onAudioStarted.bind(this));
soundCloudAudio.on('timeupdate', this.getCurrentTime.bind(this));
soundCloudAudio.on('loadedmetadata', this.getDuration.bind(this));
soundCloudAudio.on('seeking', this.onSeekingTrack.bind(this));
soundCloudAudio.on('seeked', this.onSeekedTrack.bind(this));
soundCloudAudio.on('pause', this.onAudioPaused.bind(this));
soundCloudAudio.on('ended', this.onAudioEnded.bind(this));

any thoughts? Everything is still working... very odd!

thanks
Dave

Multiple players on a page sometimes don't load

I'm having an issue where I have a page that has 5 or more on it and when I load the page, sometimes several of the buttons will remain "Loading" forever. Has anyone else experienced this and is there a better way to do this?

import { SoundPlayerContainer } from 'react-soundplayer/addons';
import { Progress, PlayButton, Timer } from 'react-soundplayer/lib/components';

class CustomPlayer extends React.Component {
    play() {
        let { soundCloudAudio, playing } = this.props;
        if (playing) {
            soundCloudAudio.pause();
        } else {
            soundCloudAudio.play();
        }
    }

    render() {
        let { track, playing, currentTime, duration, soundCloudAudio} = this.props;

        if (!track) {
            return <div>Loading...</div>;
        }

        return (
            <div className="playerParent">
                <Col sm={3}>
                    <ButtonToolbar>
                        <Button bsStyle="primary"
                                active
                                onClick={this.play.bind(this)}
                                className="playButton btn-block"
                        >
                            {playing ? 'Pause' : 'Play'}
                        </Button>
                    </ButtonToolbar>
                </Col>
                <Col sm={6}>
                    <Progress
                        className="progress"
                        innerClassName="progress-bar"
                        value={currentTime / duration * 100 || 0}
                        {...this.props}
                    />
                </Col>
                <Col sm={3}>
                    <Timer
                        className="timer"
                        duration={duration}
                        currentTime={currentTime}
                        {...this.props}
                    />
                </Col>
            </div>
        );
    }
}




// Episode component - represents a single episode item
export default class Episode extends Component {
    render() {
        return (
            <Jumbotron className="episode">
                <Row>
                    <Col xs={4}>
                        <img src={this.props.episode.image} className="img-responsive"/>
                    </Col>
                    <Col xs={8}>
                        <h4 className="episodeTitle">{this.props.episode.text}</h4>
                        <p className="episodeDescription">{this.props.episode.description.split('\n').map(function(item, i) {
                            return (
                                <span key={i}>
                                {item}<br/>
                                </span>
                            )
                        })}</p>
                    </Col>
                </Row>
                <Row>
                    <SoundPlayerContainer {...this.props.episode}>
                        <CustomPlayer />
                    </SoundPlayerContainer>
                </Row>
            </Jumbotron>
        );
    }
}

Episode.propTypes = {
    // This component gets the task to display through a React prop.
    // We can use propTypes to indicate it is required
    episode: PropTypes.object.isRequired,
};

You can see it in action on: www.babeswatchbuffy.com

Thanks so much!

react sound cloud not working on android

Not working on a Samsung s6, also any chance you can provide a guide on how to set up multiple soundcloud player instances that are controlled through one parent? for example i have multiple players but I can play each one individually, when the case I want is that playing one song should pause all the other players. Other than that this component is awesome!

react-soundplayer + Ionic

I'm new in the development of apps and use various plugins to play SoundCloud in an application with Ionic.

In several are giving a delay of 10s to start the audio.

I tried using Plangular, but the author pointed me this plugin,

I tried to use this plugin, the could not implement.

Someone would have an example to implement this plugin with Ionic?

I thank you!

Safari issue loading SoundCloud audio stream

Safari 9.1.2 is not able to return SoundCloud stream due to the following error:

XMLHttpRequest cannot load https://api.soundcloud.com/tracks/196316910.json?client_id=08f79801a998c381762ec5b15e4914d5. Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers.

I built the current /examples and was able to replicate the issue. This issue does NOT occur on the older /examples that is hosted at http://labs.voronianski.com/react-soundplayer/.

how do you get this working properly

Sorry if this is a noob question. Not sure how I can go about getting this on my page. Having difficulties with the whole require() thing. Is there a way to just load a script onto the page?

PlayButton in Custom Audio player (AWSSoundPlayer) not working

I made a custom audio player component which takes in streamUrl like the example

...
const streamUrl = 'https://s3-eu-west-1.amazonaws.com/react-soundplayer-examples/ksmtk-reborn-edit.mp3';
...
<MySoundPlayerComponent
        streamUrl={streamUrl} //title prop not required for this custom component
        preloadType="metadata" />
...

the player then propagates the streamUrl to all subcomponents like Playbuttons, Timer, Progressbar

Clicking on the PlayButton component doesnt do anything

add 'ended' event callback

Hi,
I have started using your component few weeks ago in my own project.
It is amazing!

I am not sure if anyone else would find useful to add callback for 'ended' event

in my case I need it to create custom playlist (array of SC tracks playing next one on previous ended)
I would be super happy to contribute and make PR with this change,
if you find it helpful/ useful
cheers

Doesn't work in ie11

Hello,

I'm having issues getting this to work with IE11. The demo site is also not working in ie11. Pressing play on the examples doesn't do anything.

The error is in the _jsonp function

script.src = _appendQueryParam(url, 'callback', id);

IE throws error saying 'invalid property type'

Any thoughts?

Doesn't work on IE 11 - invalid property value

Hi there, I've already looked at #53 and there are still problems with IE 11.
I think this is a different problem, so I made this a separate issue.

On http://labs.voronianski.com/react-soundplayer/#ExamplePlayers IE 11 console outputs

SCRIPT380: Invalid property value.
bundle.min.js (23,5634)

On my site (with debugging enabled) I get

request failed Error: Invalid property value.
   "request failed"
   {
      [functions]: ,
      __proto__: { },
      description: "Invalid property value.",
      message: "Invalid property value.",
      name: "Error",
      number: -2146827908,
      stack: "Error: Invalid property value.
   at SoundCloud.prototype._jsonp (http://10.0.2.2:3000/bundle.js:78193:6)
   at SoundCloud.prototype.resolve (http://10.0.2.2:3000/bundle.js:78155:6)
   at requestAudio (http://10.0.2.2:3000/bundle.js:77992:22)
   at componentDidMount (http://10.0.2.2:3000/bundle.js:77969:18)
   at Anonymous function (http://10.0.2.2:3000/bundle.js:23415:14)
   at measureLifeCyclePerf (http://10.0.2.2:3000/bundle.js:23225:6)
   at Anonymous function (http://10.0.2.2:3000/bundle.js:23414:12)
   at notifyAll (http://10.0.2.2:3000/bundle.js:15771:10)
   at ON_DOM_READY_QUEUEING.close (http://10.0.2.2:3000/bundle.js:26144:6)
   at Mixin.closeAll (http://10.0.2.2:3000/bundle.js:16942:12)"
   }

I am using react-soundplayer 1.0.0-rc4 and soundcloud-audio 1.0.4

Do you have any ideas I could test?

Support all tracks resolveUrl

Soundcloud has all tracks page for the artist:

https://soundcloud.com/%artistName%/tracks

I suppose SoundPlayer should support this too.

onReady callback doesn't seem to work

Tried to use the onReady props callback but it is never being called. Is there a way to resolve this issue? Would appreciate any help!

    state = {
        isReadyToPlay: false
    };

    _setReady = () => {
        this.setState({
            isReadyToPlay: true
        });
    };

// some code before
<SoundPlayerContainer 
  onReady={this._setReady} 
  clientId={getClientID()} 
  resolveUrl={resolveUrl}>
    // Player components code
</SoundPlayerContainer>
// some code after

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.