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

@polyv/vod-player-electron-sdk

v1.3.0

Published

vod-player-electron-sdk - a Electron SDK that enables developers to integrate video playback capabilities into their Electron applications.

Downloads

7

Readme

SDK开发说明

@polyv/vod-player-electron-sdk 是保利威云点播PC端Electron版SDK,为客户提供保利威云点播一系列功能,包括下载、播放、防录制功能,能让客户快速接入自有业务。

环境要求

node: >= 16.17.1 | 18.20.3
Electron: 16.x.x
Windows: >= win7 sp1
Mac: >= 10.15.0+

开发说明

Demo构建示例:

  //定义C++依赖下载路径,SDK将根据环境变量下载SDK实现,具体路径请咨询客服
  export DEV_NODE_DOWNLOAD_URL="https://xxxx/PCPlayerSDK-Win-x64.7z" // win64
  export DEV_NODE_DOWNLOAD_URL="https://xxxx/PCPlayerSDK-Win-x86.7z" // win32
  export DEV_NODE_DOWNLOAD_URL="https://xxxx/PCPlayerSDK-Mac-x64.zip" // mac
  
  //构建demo,默认情况下,npm会根据系统类型架构选择对应的二进制架构类型
  npm ci / npm install
  //特殊情况下,需要指定构建的二进制架构类型(比如:在M1的MAC上构建intel-x64的二进制)
  npm ci --arch=ia32 // win32
  npm ci --arch=x64 // win64
  npm ci --arch=x64 // mac-intel-64

  //运行demo
  npm run start

开发文档

SDK 功能模块说明

  • define: 定义所有的类型与接口,事件相关参数也定义在里面
  • global: SDK的全局实例与方法
  • player: 播放器实例的方法
  • downloader: 下载器实例的方法

SDK 全局函数

const plvPlayerCore = createPlvPlayerCore()
console.log('sdk version:', plvPlayerCore.getSdkVersion())
// 设置SDK日志路径(utf-8)与级别
plvPlayerCore.setSdkLogLevel(PLVLogLevel.Info)
plvPlayerCore.setSdkLogFile('appData/xxx.log')
// 设置 viewer 信息,用于定位播放质量问题,在线播放下可以通过后台来查看,建议调用此接口设置信息
// 最新 vrm12/vrm13 下必须设置,否则播放会报错
const viewerInfo = {
  viewerId: '业务id', // 唯一值
  viewerName: '业务name',
}
plvPlayerCore.setSdkViewerInfo(viewerInfo)
// 初始化SDK
const accountInfo = {
  userId: 'xxx',
  appId: 'xxx',
  subAccount: false
}
plvPlayerCore.init(accountInfo)
// 释放SDK,释放后对象不再可用.建议关闭程序时释放
plvPlayerCore.release()

// 事件观察
const fn = (evt) => {
  console.log(evt)
}
plvPlayerCore.on(PLVEventType.PlayerPlay, fn)
plvPlayerCore.off(PLVEventType.PlayerPlay, fn)

// 以下为全局相关设置,也可以在初始化前设置,详见文档
plvPlayerCore.setSdkHwdecEnable(false)
plvPlayerCore.setSdkKeepLastFrame(true)
plvPlayerCore.setSdkLocalRememberPlay(true)
plvPlayerCore.setSdkRetryAttempts(-1, 500, 25000)

SDK 防录制

  • 硬件防录制
    当检测到采集卡等硬件录制设备插拔时触发,业务测可以根据回调判断是否禁播.SDK将尽量判断事件的准确性.
    • 参考 PLVEventType.HardwareRecording
  • 软件防录制
    在Electron架构中,您需要在Electron主进程中实现此功能.同时建议不断检测窗口标志,防止窗口标志被篡改为可录制状态.

SDK 播放器

// 创建播放器实例
const player = plvPlayerCore.createPlayer()
// 摧毁播放器-对象将不再可用
player.destroy()
// 设置播放器配置,在播放前可以不断更新使用
player.setConfig()
// 绑定视图HTML-DIV
player.bind()
// 播放
player.play()
// 停止
player.stop()
// 获取播放器相关回调
plvPlayerCore.on(PLVEventType.PlayerPlay, (evt) => {
  console.log(evt)
})

SDK 下载器

// 创建下载器实例
const downloader = plvPlayerCore.createDownloader()
// 摧毁下载器-对象将不再可用
downloader.destroy()
// 设置下载器配置
downloader.setConfig()
// 开始
downloader.start()
// 停止
downloader.stop()
// 获取下载器相关回调
plvPlayerCore.on(PLVEventType.DownloaderProgress, (evt) => {
  console.log(evt)
})

SDK 注意事项

  • SDK对象释放后不再可用,需要重新创建
  • 所有路径相关均使用utf-8编码
  • Electron中注意代码与数据安全