Skip to Content

Media Vue

Vue 3 video player, image components, and infinite media feeds for Rixl, with TypeScript props, events, and player context.

Vue 3 video player, image components, and infinite media feeds for Rixl. @rixl/media-vue provides typed Vue props, events, refs, and player context over the shared Rixl media UI.

What you get

  • Adaptive HLS playback, captions, quality selection, fullscreen, and picture-in-picture.
  • Images with lazy loading and ThumbHash placeholders when available.
  • Vertical media feeds with pagination, looping, and automatic advancement.
  • Vue events and v-model:muted support for feeds.
  • Included player styles; no Tailwind CSS or custom-element compiler configuration is required.

Install

npm install @rixl/media-vue

Requires Vue 3.3 or later. Core and Lit are included as dependencies.

Quick start

Wait for the SDK connection before rendering media. Replace the API key and media ID with your Rixl values.

<script setup lang="ts">
import {onMounted, ref} from "vue";
import {connect} from "@rixl/media-vue/core";
import {Video} from "@rixl/media-vue/video";

const ready = ref(false);
const error = ref("");

onMounted(async () => {
  try {
    await connect({baseUrl: "https://api.rixl.com", apiKey: "YOUR_PUBLIC_API_KEY"});
    ready.value = true;
  } catch {
    error.value = "Unable to connect to Rixl.";
  }
});
</script>

<template>
  <p v-if="error" role="alert">{{ error }}</p>
  <Video v-else-if="ready" id="YOUR_VIDEO_ID" :muted="true" class="player" />
  <p v-else role="status">Loading media…</p>
</template>

<style scoped>
.player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}
</style>

Use credentials intended for browser access. If your application already authenticates the shared @rixl/sdk client, reuse that connection instead.

Images and feeds

After connecting, import the components you need:

<script setup lang="ts">
import {ref} from "vue";
import {Image} from "@rixl/media-vue/image";
import {Feed} from "@rixl/media-vue/feed";

const muted = ref(true);
</script>

<template>
  <Image id="YOUR_IMAGE_ID" alt="Mountain lake at sunrise" class="image" />
  <Feed feedId="YOUR_FEED_ID" v-model:muted="muted" class="feed" />
</template>

<style scoped>
.image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.feed {
  display: block;
  height: 36rem;
}
</style>

Production media is resolved by id or feedId through the SDK.

Events and custom controls

Video emits play, pause, ended, pausedChange, loadingChange, timeUpdate, loadedMetadata, volumeChange, rateChange, qualityChange, and error. Image emits loadingChange; Feed emits muteChange and update:muted.

<Video id="YOUR_VIDEO_ID" @paused-change="(paused) => console.log(paused)" />

Use a component template ref to access its exposed element, the underlying Lit element. <VideoPlayer> shares a player scope with sibling controls; usePlayerId() and useOptionalPlayerId() are available from /video during setup. Playback actions and state live in /core.

Styling, rendering, and imports

The wrappers include Lit's styles inside shadow DOM. Your class and style affect the host layout; internal player controls are configured through component props.

The examples target browser rendering. In a Nuxt app, mount media inside a client-only boundary and initialize the SDK there. Full server-rendered media markup is not provided by this adapter.

ImportExports
@rixl/media-vue/imageImage, ImageProps
@rixl/media-vue/videoVideo, VideoPlayer, props, and player-context composables
@rixl/media-vue/feedFeed, FeedProps
@rixl/media-vue/coreHeadless APIs, stores, utilities, and types
@rixl/media-vueComponents and Core exports

Subpath imports keep an image-only app free of video, feed, and HLS code. See the Vue guide for integration details.