Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Player.seekTo is not a function

$
0
0

I have the following init:

Player.init(element.id, playerId, () => {    this.onReady(videoId, socket)})

and callback:

onReady(videoId, socket){    let msgContainer = document.getElementById("msg-container")    let msgInput     = document.getElementById("msg-input")    let postButton   = document.getElementById("msg-submit")    let vidChannel   = socket.channel("videos:"+ videoId)    postButton.addEventListener("click", e => {        let payload = {body: msgInput.value, at: Player.getCurrentTime()}        vidChannel.push("new_annotation", payload)            .receive("error", e => console.log(e) )        msgInput.value = ""    })    msgContainer.addEventListener("click", e => {        e.preventDefault()        let seconds = e.target.getAttribute("data-seek") ||                      e.target.parentNode.getAttribute("data-seek")        if (!seconds) { return }        Player.seekTo(seconds)    })    ...}

However the Player.seekTo function fails with _player2.default.seekTo is not a function while the Player.getCurrentTime() function call works just as expected.

edit: I have also tried it with the seekahead parameter, same result.


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>