thangngoc89 / react-howler

A React.js wrapper for howler.js (audio player)
https://khoanguyen.me/react-howler/
MIT License
359 stars 84 forks source link

Accessing other Howler methods... #83

Closed barnardnicholas closed 4 years ago

barnardnicholas commented 4 years ago

Hi, I love the library and I have the basic functionality working but I'm confused by some of the docs.

I'm trying to access the "stereo" method of a Howl by following the example given in the readme, under "Other howler.js methods" (pasted below), but I get errors from React when I try to do anything with this.player.howler (Not recognised as a method, "expected assignment or function call..., etc)

If I console log "this.player" I can see the "stereo" method, along with all the other ones but I'm having trouble accessing it.

Any help would be appreciated, thanks!

import React, { Component } from 'react'
import ReactHowler from 'react-howler'

class App extends Component {
  getHowler () {
    this.player.howler
  }

  getDuration () {
    this.player.duration()
  }

  getSeek () {
    this.player.seek()
  }

  setSeek () {
    this.player.seek(0.5)
  }
  // This sound file may not work due to cross-origin setting
  render () {
    return(
      <ReactHowler
        src='http://goldfirestudios.com/proj/howlerjs/sound.ogg'
        playing={true}
        ref={(ref) => (this.player = ref)}
      />
    );
  }
}
Stenerson commented 4 years ago

Hey @barnardnicholas, I had some notification issues and have been busy with some other stuff since you posted this (sorry it's been ignored for so long). Did you end up getting this figured out or is it still an issue?

I'm going to close this but if you're still having issues can you maybe mock up one of the examples with where you're getting the error. I'd be happy to check it out. ✌️