1.4.4 • Published 12 months ago

@plutotcool/vue-freecaster v1.4.4

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

vue-freecaster

Freecaster video player integration for vue.

Installation

pnpm install @plutotcool/vue-freecaster

Usage

Plugin

The plugin loads the required freecaster scripts and globally registers the FreecasterPlayer component in your vue app.

import Vue from 'vue';
import { FreecasterPlugin } from '@plutotcool/vue-freecaster'

Vue.use(FreecasterPlugin)

Player composable

The usePlayer composable provide a reactive freecaster player instance attached to an element ref.

<script setup lang="ts">
  import { usePlayer } from '@plutotcool/vue-freecaster'

  const { element, attributes, player } = usePlayer({
    options: {
      videoId: '...'
    }
  })
</script>

<template>
  <div ref="element" v-bind="attributes"/>
</template>

Player component

The FreecasterPlayer component is a wrapper around the usePlayer composable. It also provides models and slot props for the player state.

<script setup lang="ts">
  import { FreecasterPlayer, type Player } from '@plutotcool/vue-freecaster'

  const player = shallowRef<Player>()
  const muted = ref(false)
  const paused = ref(false)
  const volume = ref(1)
  const currentTime = ref(0)
  const readyState = ref(0)
  const fullscreen = ref(false)
</script>

<template>
  <FreecasterPlayer
    video-id="..."
    v-model="player"
    v-model:muted="muted"
    v-model:paused="paused"
    v-model:volume="volume"
    v-model:current-time="currentTime"
    v-model:ready-state="readyState"
    v-model:fullscreen="fullscreen"
  />
</template>
<script setup lang="ts">
  import { FreecasterPlayer } from '@plutotcool/vue-freecaster'
</script>

<template>
  <FreecasterPlayer
    video-id="..."
    #default="{
      player,
      muted,
      paused,
      volume,
      currentTime,
      readyState,
      fullscreen
    }"
  >
    <!-- ... !-->
  </FreecasterPlayer>
</template>
1.4.4

12 months ago

1.4.3

12 months ago

1.4.2

12 months ago

1.4.1

12 months ago

1.4.0

12 months ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.0.2

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago