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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@coolita-os/m3u8-ad-js-sdk

v0.0.6

Published

A library for coolita os loading the m3u8 ad with static typing for the SDK

Readme

m3u8-ad-js-sdk

Coolita OS Web 使用的m3u8 广告SDK插件库

安装

yarn add @coolita-os/m3u8-ad-js-sdk or npm install --save @coolita-os/m3u8-ad-js-sdk

使用

一、在需要插入广告的节点添加广告节点元素和样式控制

<video
    style="display: none;"
    class="ad-video"
    id="ad-video">
</video>
    .ad-video {
        width: 100%;
        height: 100%;
        object-fit: cover; // 保持原有尺寸比例。但部分内容可能被剪切。
    }

二、JavaScript/TypeScript 调用实现部分

import { M3u8AdPlayer } from '@coolita-os/m3u8-ad-js-sdk'

// 创建广告播放器实例,内部实现自动调用requestAd()发起广告请求等其他逻辑
let m3u8AdPlayerInstance = new M3u8AdPlayer({
    adVideoElement: document.getElementById('ad-video'), // 广告节点元素
    contentElement: null, // 内容推荐位节点元素video/div,没有传null
    adContainerElement: document.getElementById('ad-container'), // 广告UI容器元素
    adUIElement: document.getElementById('ad-ui'), // 广告UI元素/没有传null
    adTagUrl: '', // 广告请求tagUrl
    bitrate: 300, // 广告比特率
    muted: true, // 是否静音,默认静音
    observeVideoSize: true, // 是否监听视频窗口大小变化做处理
    instanceApi: { // 实例需要实现的所有回调函数
        onStarted: () => { 
            // 即将开始播放
        },
        onAdErrorEvent: (errorData) => {
            // 广告播放发送异常
        }
    }
})

2、销毁广告播放器实例

    m3u8AdPlayerInstance.destroy()
    m3u8AdPlayerInstance = null