Skip to content

Starting a video at specific time #1081

Answered by fisher0fm3n
fisher0fm3n asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah I did


// Function base component
const MyComponent = () => {
  const ref = useRef()

  useEffect(() => {
    console.log("internal plyr instance:", ref.current.plyr)
  })

  return <Plyr ref={ref} />
}

// Class base component
class MyComponent extends Component {
  constructor(props) {
    super(props)
    this.player = createRef()
  }

  componentDidMount() {
    console.log("internal plyr instance", this.player.current.plyr)
  }

  render() {
    return <Plyr ref={(player) => (this.player.current = player)} />
  }
}

I used the function based component here. It kept returning undefined for me initially because it loaded before the data I was pulling in before my API could be appl…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@fisher0fm3n
Comment options

Answer selected by fisher0fm3n
@shashtag
Comment options

Comment options

You must be logged in to vote
1 reply
@shashtag
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants