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

chimee-plugin-snapshot

v0.1.0

Published

snapshot plugin for Chimee Player

Downloads

3

Readme

chimee-plugin-snapshot

Snapshot plugin for Chimee Player

简单好用的 Chimee 播放器截图插件

Install

# 依赖于 chimee, 首先需要安装 chimee
npm i chimee
# 安装截图插件
npm i chimee-plugin-snapshot
import ChimeePluginSnapshot from 'chimee-plugin-snapshot'
import Chimee from 'chimee'

Chimee.install(ChimeePluginSnapshot)

const player = new Chimee({
  plugin: [{
    name: ChimeePluginSnapshot.name,
    watermark: {
      text: "chimee",
      // image: "example.png",
      x: 100,
      y: 100,
      repeat: true,
      rotate: 30
    },
    onSnapshotted(snapshot) {
      // do
    }
  }]
})

Config

watermark

水印功能默认是关闭的,如果要开启,必须配置 watermark 参数,而且至少要配置其中的 textimage 参数(非空字符串)

  • text 水印字符
  • image 水印图片,不能和 text 共用,否则只按照 text 设置水印而忽略 image 参数
  • x 开始位置横坐标(左上角为原点,向右为正方向,单位 px),默认 -10 即距离右边 10px
  • y 开始位置纵坐标(左上角为原点,向下为正方向,单位 px),默认 -10 即距离下边 10px
  • rotate 旋转角度(正为顺时针,反之逆时针),默认 0 即不旋转
  • fontSize 字体大小,默认值 24只对 text 水印有效
  • fontFamily 字体名称,默认值 "sans-serif"只对 text 水印有效
  • fontColor 字体颜色,支持 RGB、RGBA、HLS、十六进制数值等格式,默认值 "#rgba(0, 0, 0, 0.5)"只对 text 水印有效
  • opacity 透明度,0 为全透明,1 为不透明,默认 0.5只对 image 水印有效

onSnapshotted(snapshot)

本插件只提供生成截图功能,至于截图生成之后如何使用,完全由开发者自己决定

这个参数表示截图完成的回调函数,开发者可以在这里完成使用截图的逻辑

回调函数的参数 snapshot 表示生成截图的对象,其中的属性包括:

  • blob 截图的 Blob 对象,方便开发者实现上传图片等逻辑
  • src 截图的 URL ,其实就是通过 URL.createObjectURL(blob) 生成的,方便开发者实现展示图片等逻辑
  • width 截图的宽(px)
  • height 截图的高(px)

examples