Skip to content

PlayerVars option "start" must be integer number #5

Open
@suterma

Description

@suterma

This is maybe more a documentation issue, because the limitation might be stemming from the underlying IFrame player.

When using the usePlayer constructor with the composition API, as documented here: https://vue-youtube.github.io/docs/usage/composable#configuration, the start value MUST be an integer (whole) number.

If fractions are used (e.g. value 500.1), the value is not applied and the video starts from the beginning.

The solution for this issue might be to document this limitation in the appropriate place, maybe with some simplified example code.

A working example:

const {
    onReady,
    onStateChange,
    onError,
    // togglePlay,
    // toggleMute,
    // toggleLoop,
    instance,
} = usePlayer(videoId, youtubePlayerElement, {
    /** See https://developers.google.com/youtube/player_parameters#Parameters */
    playerVars: {
        autoplay: 0,
        disablekb: 1 /* replayer handles keyboard events on it's own*/,
        enablejsapi: 1,
        color: 'white',
        controls: 1,
        // Setting the playlist to the one video enables looping the single video itself
        // See https://stackoverflow.com/a/25781957/79485
        playlist: videoId.value,
        start: 500, // startPosition, MUST be an integer number,
        rel: 0,
    },
    cookie: true,
});

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions