Skip to content

Instantly share code, notes, and snippets.

@fernando-mc
Last active November 9, 2021 18:37
Show Gist options
  • Save fernando-mc/24b723986beccb1351fda48def85d576 to your computer and use it in GitHub Desktop.
Save fernando-mc/24b723986beccb1351fda48def85d576 to your computer and use it in GitHub Desktop.
Vue and Mux
<template>
<video
id="my-player" class="video-js vjs-16-9" controls preload="auto" width="100%">
</video>
</template>
<script>
import videojs from '@mux/videojs-kit';
import '@mux/videojs-kit/dist/index.css';
export default {
name: "Video",
mounted() {
this.$nextTick(function () {
const player = videojs('my-player', {
timelineHoverPreviews: false,
plugins: {
mux: {
debug: false,
data: {
env_key: 'ENV_KEY_HERE',
video_title: 'Example Title'
}
}
}
});
player.src({
src: "MY_SOURCE_VIDEO_PLAYBACK_ID",
type: "video/mux",
});
})
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment