Skip to content

Возобновление воспроизведения с ранее запомненного места #216

Discussion options

You must be logged in to vote

Для работы с плеером нужна подписка. У меня нет, поэтому проверить не могу. Но что-то вроде того:

function savePlayback() {
  let playback = Player.getPlayback()
  if (!playback.isEmpty() && playback.context && playback.context.uri) {
    let tracks = Source.getPlaylistTracks('', Helper.parseId(playback.context.uri))
    playback.itemPosition = tracks.findIndex(t => t.id == playback.item.id)
    Helper.updateState('last_saved_playback', playback)
  }
}

function resumePlayback() {
  let playback = Helper.readState('last_saved_playback')
  Player.resume({
    context_uri: playback.context.uri,
    position_ms: playback.progress_ms,
    offset: { "position": playback.itemPosition }
  })
}

К…

Replies: 2 comments 56 replies

Comment options

You must be logged in to vote
5 replies
@Bedmit
Comment options

@Chimildic
Comment options

@Bedmit
Comment options

@Chimildic
Comment options

@Bedmit
Comment options

Answer selected by Chimildic
Comment options

You must be logged in to vote
51 replies
@Chimildic
Comment options

@Bedmit
Comment options

@Bedmit
Comment options

@Chimildic
Comment options

@Bedmit
Comment options

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