npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mindedge/vuetify-player

v0.4.0

Published

Accessible, localized, full featured media player with Vuetifyjs

Downloads

133

Readme

Vuetify-Player

An accessible, localized, full featured media player with Vuetifyjs

Table of Contents


Supported File Types:

| Video | Audio | Poster Image | | ----------- | ----- | ---------------- | | mp4 | mp3 | png | | webm | wav | jpg | | ogg | ogg | gif (+ animated) | | YouTube URL | | |

Quick Start

1. Install

npm install @mindedge/vuetify-player

2. Import

import VuetifyPlayer from '@mindedge/vuetify-player'

3. Insert tag

<VuetifyPlayer :src="src" />

4. Define your src

src: {
	sources: [
	  {
	    src: "https://cdn.example.com/some-video.mp4",
	    type: "video/mp4",
	  },
	],
},

4. Enjoy~

Full media src structure

{
  name: "", // The video name. Used on playlists
  poster: "", // A video specific poster. Overrides poster attribute
  ads: [
    {
      play_at_percent: 0,
      sources: [
        {
          src: "https://domain.test/ad_example.mp4",
          type: "video/mp4",
        },
        // You can define additional fallback sources here
      ],
      tracks: [
        {
          src: "https://domain.test/ad_example_en-US.vtt",
          kind: "captions",
          srclang: "en-US",
          default: true,
        },
        // You can define additional language tracks here
      ],
    },
  ],
  sources: [
    {
      src: "https://domain.test/example.mp4",
      type: "video/mp4",
    },
    // You can define additional fallback sources here
  ],
  tracks: [
    {
      src: "https://domain.test/example_en-US.vtt",
      kind: "captions",
      srclang: "en-US",
      default: true,
    },
    // You can define additional language tracks here
  ],
}

The src attribute

The bare minimum,

src: {
  sources: [
    {
      src: "https://cdn3-d.mindedgeonline.com/videos/how-we-help-video.mp4",
      type: "video/mp4",
    },
  ],
}
<VuetifyPlayer :src="src" />

See Full media src structure

The playlist attribute

This accepts an array of media sources to play in a playlist format. Eg:

playlist: [
  { sources: [{ src: "first.mp4", type: "..."}], tracks: [...] },
  { name: "", sources: [{ src: "second.mp4", type: "..."}], tracks: [...] },
  { poster: "", sources: [{ src: "third.mp4", type: "..."}], tracks: [...] },
  // Additional media source objects
]
<VuetifyPlayer :playlist="playlist" />

When passing this attribute a playlist menu will appear and media will auto-advance from one source to the next on completion. Both of these can be adjusted with playlistmenu and playlistautoadvance. See Supported <VuetifyPlayer> Attributes for more information

For more informationm about media sources see Full media src structure

The ads array

The <VuetifyPlayer> supports video injection via the ads array. This can be used to inject any other media source at any time during playback.

For example:

  • For preroll set play_at_percent to 0
  • For midroll set play_at_percent to 50
  • For postroll set play_at_percent to 100

For multiple ads simply define multiple objects in the ads array.

ads: [
    {
        play_at_percent: 0,
        sources: [
            {
                src: 'https://domain.test/ad1_example.mp4',
                type: 'video/mp4',
            },
            // You can define additional fallback sources here
        ],
        tracks: [
            {
                src: 'https://domain.test/ad1_example_en-US.vtt',
                kind: 'captions',
                srclang: 'en-US',
                default: true,
            },
            // You can define additional language tracks here
        ],
    },
    // You add additional ad objects here
]

See Full media src structure for where the ads array is placed

Supported <VuetifyPlayer> Attributes

| Attribute Name | Datatype | Allowed Values | Default | Description | | ------------------------------ | --------- | -------------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | language | String | en-US | See BCP 47 Spec | "en-US" | Defines which locale the video player controls will load in | | src | Object | See src attribute | {} | A single media source | | playlist | Array | See playlist attribute | [] | A collection of media source(s) | | type | String | auto | video | audio | image | "auto" | In audio mode the player has a max-height of 40px | | autoplay | Boolean | true | false | false | Autoplay on load. It's in the spec but DON'T USE THIS | | autopictureinpicture | Boolean | true | false | false | Start with picture in picture mode | | controls | Boolean | true | false | true | Show video controls. When false only play/pause allowed but clicking on the video itself | | controlslist | String | nodownload nofullscreen noremoteplayback | "nodownload noremoteplayback" | Space separated string per . Allowed 'nodownload nofullscreen noremoteplayback' | | crossorigin | String | anonymous | use-credentials | "anonymous" | Indicates whether to use CORS to fetch the related video | | disablepictureinpicture | Boolean | true | false | true | Shows the picture in picture button | | disableremoteplayback | Boolean | true | false | true | Shows the remote playback button but functionality does not exist when clicked | | height | String | css pixel value | "auto" | The players height | | width | String | css pixel value | "100%" | The players width | | rewind | Boolean | true | false | true | Enabled the rewind 10s button | | loop | Boolean | true | false | false | Loop the video on completion | | muted | Boolean | true | false | false | Start the video muted | | playsinline | Boolean | true | false | false | Force inline & disable fullscreen | | poster | String | image url | "" | Overridden with the playlist.poster if one is set there | | preload | String | "none" | "metadata" | "auto" | _empty string_ | "" | Empty string = auto Provide a hint to the browser about what the author thinks will lead to the best user experience with regards to what content is loaded before the video is played. | | captionsmenu | Boolean | true | false | true | Allow the captions below the video | | playlistmenu | Boolean | true | false | true | Show the playlist menu if there's multiple videos | | playlistautoadvance | Boolean | true | false | true | Play the next source group | | playbackrates | Array | [array of numbers] | [0.5, 1, 1.5, 2] | Default playback speeds. Anything below 0.25 and above 4 will make cause audio distortion | | captions-expanded | Boolean | true | false | undefined | Supports .sync. The initial state of the captions transcript being expanded. | | captions-hide-expand | Boolean | true | false | true | Show / allow the captions transcript expand button for users | | captions-paragraph-view | Boolean | true | false | undefined | Supports .sync. The initial state of the captions transcript paragraph view | | captions-hide-paragraph-view | Boolean | true | false | false | Allow the captions transcript paragraph view for users | | captions-autoscroll | Boolean | true | false | false | Supports .sync. The initial state for the captions transcript autoscroll state | | captions-hide-autoscroll | Boolean | true | false | undefined | Allow users to enable / disable captions transcript autoscrolling | | captions-hide-close | Boolean | true | false | false | Allow users to show / hide the captions transcript box | | captions-visible | Boolean | true | false | false | Supports .sync. The initial state for the captions transcript visibility |

Supported <VuetifyPlayer> Events

| Event name | Returns | When it's triggered | | -------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------- | | abort | Event | Download interrupted | | canplay | Event | Playback can start | | canplaythrough | Event | Playback can continue and should not be interrupted. Readstate is 3 | | emptied | Event | The network connection is down | | ended | Event | When playback has stopped because the end of the media was reached | | error | Event | A network error occurred during the download | | load | Event | The media is being initialized and loaded | | loadeddata | Event | When the frame at the current playback position of the media has finished loading; often the first frame | | loadedmetadata | Event | When the metadata has been loaded | | play | Event | The media has received a request to start playing | | pause | Event | Playback has been suspended | | progress | Event | The progress event is fired periodically as the browser loads a resource. | | seeking | Event | Playback has moved to a new location | | timeupdate | Object | The current time was changed. Object contains { event: Event, current_percent: Number } | | ratechange | Number | The playback speed multiplier | | stalled | Event | The browser tried to download but has not received data yet | | volumechange | Number | The volume or muted button changed. Value from 0.0 to 1 | | waiting | Event | Pause playback to download more data | | mouseover | MouseEvent | Mouse over the media | | mouseout | MouseEvent | Mouse left the media | | click:fullscreen | true | false | When the fullscreen button is clicked. true on fullscreen, false on exiting fullscreen | | click:pictureinpicture | true | false | When the picture-in-picture button is clicked. true on enabled, false on disabled | | click:captions-expand | true | false | When the expand captions button is clicked. true on expanded, false on collapsed | | click:captions-paragraph-view | true | false | When the view as paragraph button is clicked. true when viewing as a paragraph, false when viewing as timed captions | | click:captions-autoscroll | true | false | When the autoscroll captions button is clicked. true on autoscrolling otherwise false | | click:captions-close | true | false | When the c;pse captions button is clicked. true on closed, false on visible | | update:captions-expanded | true | false | When the captions expand state is updated | | update:captions-paragraph-view | true | false | When the captions paragraph-view state is updated | | update:captions-autoscroll | true | false | When the captions autoscroll state is updated | | update:captions-visible | true | false | When the captions visible state is updated |

Supported <VuetifyPlayer> Slots

| Slot name | Attributes | Description | | ----------- | ---------- | --------------------------------------------------------------------------- | | no-source | none | Displayed over the media skeleton loader when no media source is configured |

Captions

The player supports .vtt captions as defined in the tracks array explained above.

Additionally we support the tag <c.transcript> ... </c> inline with your captions text. This tag will omit the enclosed text from the video player captions overlay but show the text in the separate interactive captions panel. This allows you to include additional information that you want to appear in the transcript that might not be appropriate to display in the video player itself.

Below is a sample.vtt on how to use the <c.transcript> tag.

WEBVTT

00:00:00.000 --> 00:00:03.999
This text will show. <c.transcript>This text is hidden from the player.</c> This is some more text to show.
This text will show up on a new line in the player.

00:00:03.000 --> 00:00:5.999
sentence here to break it up

Supported Keyboard Shortcuts

| Key | Action | | --------------- | ----------------------- | | k | Toggle play / pause | | m | Toggle mute | | {Left Arrow} | Rewind 5 seconds | | {Right Arrow} | Fast forward 5 seconds | | j | Rewind 10 seconds | | l | Fast forward 10 seconds | | {Up Arrow} | Increase volume by 10% | | {Down Arrow} | Decrease volume by 10% | | f | Toggle fullscreen | | c | Toggle closed captions |

License

MIT License

Copyright 2022 MindEdge, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.