vime-js / vime

Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
https://vimejs.com
MIT License
2.75k stars 154 forks source link

Cannot get movie duration - it is undefined #249

Open konrad-pawlus opened 3 years ago

konrad-pawlus commented 3 years ago

Bug Report

Vime version: 5.0.33

Provider:

[*] Video

Current behavior:

Duration in vmPlaybackReady id undefinied when used in Svelte.

Expected behavior:

Duration to be length of movie in seconds.

Steps to reproduce:

Related code:

<Player on:vmPlaybackReady={playbackReady}
        bind:this={videoPlayer}>
    <Video poster="">
        <source data-src="{mediaServeUrl}" type="{mediaFileType}"/>
    </Video>

    <DefaultUi>
        <!-- We can place our own UI components here to extend the default UI. -->
    </DefaultUi>
</Player>

const playbackReady = () => {
      console.log('Video player: ' + videoPlayer.duration, videoPlayer);      
};

Other information:

Svelte version: 3.42.1