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

@tower1229/videojs-plugin-source-switcher

v0.0.6

Published

videojs 视频源切换插件.基于[videojs-resolution-switcher]()项目二次开发, 支持 videojs^7.0.0; 更换构建工具为 Vite.

Downloads

5

Readme

videojs-plugin-source-switcher

videojs 视频源切换插件.基于videojs-resolution-switcher项目二次开发, 支持 videojs^7.0.0; 更换构建工具为 Vite.

preivew

videojs 系列项目

Install

npm i @tower1229/videojs-plugin-source-switcher -S
import '@tower1229/videojs-plugin-source-switcher';
import '@tower1229/videojs-plugin-source-switcher/dist/style.css';

Use

const player = videojs(this.$refs.videoPlayer, options);

// 配置插件
player.SwitcherPlugin();

// 动态配置视频源
player.updateSrc([
  {
    src: "https://static.refined-x.com/static/1080p-watermark.mp4",
    type: "video/mp4",
    label: "1080P",
    res: "1080",
  },
  {
    src: "https://static.refined-x.com/stream/1080p-720.m3u8",
    type: "application/x-mpegURL",
    label: "720P",
    res: "720",
  },
]);

或者, 也可以使用<source>标签同步配置视频源:

<video ref="videoPlayer" class="video-js">
  <source
    src="https://static.refined-x.com/static/1080p-watermark.mp4"
    type="video/mp4"
    label="1080P"
    res="1080"
  />
  <source
    src="https://static.refined-x.com/stream/1080p-720.m3u8"
    type="application/x-mpegURL"
    label="720P"
    res="720"
  />
</video>

Options

| 属性 | 说明 | 类型 | 可选 | 默认 | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | -------------------- | ----- | | default | 默认播放的视频源. 非必填. 若值为'high'将取res值最大的视频; 若值为'low'将取res值最小的视频; 若值为其他将从列表中寻找res字段与之相匹配的视频 | String | 'low' / 'high' / RES | 'low' |

Events

| 名称 | 说明 | 参数 | | ---------------- | ---------------------------- | ----- | | resolutionchange | 视频源切换事件,其实没什么用 | event |

Extensions

| 名称 | 说明 | 参数 | | --------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | player.updateSrc(sources) | 动态设置视频源方法. | sources: [Object,...]. 对象格式:{src: String, type: String, label: String [, res: String]}. res将作为视频质量排序依据, 非必填 | | player.currentResolution([label]) | 获取/设置当前视频源方法. | label: String. | | <source label="" res=""> | 为<source>标签扩展支持"label"和"res"属性, 用于同步设置视频源. | label: String; [res: String.] |