Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't prevent preloading #97

Open
Bocom opened this issue Dec 22, 2022 · 2 comments
Open

Can't prevent preloading #97

Bocom opened this issue Dec 22, 2022 · 2 comments

Comments

@Bocom
Copy link

Bocom commented Dec 22, 2022

I have created a basic Vue 3 component for video playback, but I can't seem to get preload="none" (or preload="metadata" for that matter) working.

Component code
<script setup lang="ts">
import videojs from '@mux/videojs-kit';
import '@mux/videojs-kit/dist/index.css';
import { onMounted, ref } from 'vue';

defineProps({
  videoId: String,
});

const playerEl = ref();

onMounted(() => {
  videojs(playerEl.value, {
    preload: 'none',
    controls: true,
  });
});
</script>

<template>
  <video ref="playerEl" class="video-js vjs-16-9">
    <source :src="videoId" type="video/mux" />
  </video>
</template>

I've tried setting it on the video element itself and as an option in the videojs call, but the video gets preloaded anyway. Am I doing something wrong?

I'm using version 0.11.3.

@gkatsev
Copy link
Contributor

gkatsev commented Dec 22, 2022

Unfortunately, hls.js, the default playback engine for videojs-mux-kit, doesn't respect that preload attribute/property by default.

The quick-fix is for you to try the VHS build of videojs-mux-kit. However, this does bring up something that we should support here.

@Bocom
Copy link
Author

Bocom commented Dec 23, 2022

Ah, I see, good to know!

I actually did try the VHS build but it didn't work for me, couldn't get the video to actually load (essentially the same component code), but figured that was a separate issue.

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

No branches or pull requests

2 participants