@astronautlabs/scte104

中文文档
1.0.1发布于 2024/01/20MITTypeScriptCommonJS近 30 天下载 2438

Implementation of the SCTE-104 TCP/IP protocol

原始使用文档
文档目录5 节
  1. Summary
  2. Command Line Client
  3. Client Library
  4. Server Library
  5. Roadmap

@/scte104

npm

📜 ANSI/SCTE 104 2019r1
Automation System To Compression System Communications Applications Program Interface (API)

📺 Part of the Astronaut Labs Broadcast Suite
@/is04 | @/rfc8331 | @/rtp | @/scte104 | @/scte35 | @/st2010 | @/st291

🚀 Production Quality
This library is functionally complete and is ready for use in production.


A complete implementation of the SCTE-104 TCP/IP protocol in Typescript. Supports both client and server, and includes a command line client.

Summary

This library provides a low-level, compliant implementation of the Automation System to Compression System TCP/IP signalling protocol specified in SCTE-104. It can be used to make calls to compliant SCTE-104 "injectors" or to implement SCTE-104 "injectors" themselves.

The library supports all of the messages for Provisioning and Alarm Management (PAMS), encryption, scheduling, and nearly all the messages that are outside of the "Simple Profile" specified in SCTE-104. Messages which are not natively supported can still be sent and received using custom implementations.

Uses @/bitstream to handle bitstream serialization/deserialization.

Command Line Client

This package also includes a simple command-line client for sending quick splice start/end messages to a SCTE 104 injector/automation system.

npm install @astronautlabs/scte104 -g
scte104 --server injector.example.com splice-start --immediate --program-id 12345

For complete set of options, use scte104 --help.

Client Library

import * as SCTE104 from "@astronautlabs/scte104";

async function main(argv : string[]) {
    let client = new SCTE104.Client();
    await client.connect('10.10.10.0');
    await client.init();

    // Signal a spliceStart_normal in immediate mode
    await client.multipleOperations({
        operations: [
            <SCTE104.Splice>{
                opID: SCTE104.MOP.SPLICE,
                splice_insert_type: SCTE104.SPLICE_START_NORMAL,
                splice_event_id: Date.now() / 1000,
                unique_program_id: 22211,
                pre_roll_time: 4000,
                break_duration: 0,
                avail_num: 0,
                avails_expected: 0,
                auto_return_flag: 1
            }
        ]
    })

    // spliceEnd_normal
    await client.multipleOperations({
        operations: [
            <SCTE104.Splice>{
                opID: SCTE104.MOP.SPLICE,
                splice_insert_type: SCTE104.SPLICE_END_NORMAL,
                splice_event_id: Date.now() / 1000,
                unique_program_id: 22211,
                pre_roll_time: 4000,
                break_duration: 0,
                avail_num: 0,
                avails_expected: 0,
                auto_return_flag: 1
            }
        ]
    })
}

main(process.argv.slice(1));

Server Library

import * as SCTE104 from '@astronautlabs/scte104';

let server = new SCTE104.Server();
server.messageReceived.subscribe(event => {

    // For example:
    
    if (event.message.opID == SCTE104.OP.INIT_REQUEST) {
        await event.connection.sendMessage(new SCTE104.InitResponse().with({
            result: SCTE104.RESULT.SUCCESS
        }));
    }
});
server.listen();

The class of event.message is dependent on the type of message being sent. It can be a subclass of SingleOperationMessage or an object of type MultipleOperationMessage. You can compare the opID field of the message to the constants found in SCTE104.OP and SCTE104.MOP, depending on the type of operation you are interested in.

event.connection represents the incoming network connection which sent the message. This allows you to respond once you've completed processing on the incoming message.

You (as the caller of the library) are expected to provide your own application logic. The Server class just exposes the ability to accept a connection from a '104 client, subscribe to notifications of incoming messages from that connection, and send messages back.

Roadmap

  • Provide an easy to access API for SCTE-104 encoding/decoding for auxiliary usecases
  • Provide an optional higher-level, opinionated fluent API on top

版本与发布记录

@astronautlabs/scte104 共发布 26 个版本,首次发布于 2020/04/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2024/01/202 年前
1.0.02022/11/113 年前
0.3.22022/11/113 年前
0.3.12022/11/113 年前
0.3.02022/11/113 年前
0.2.12022/10/224 年前

关于 @astronautlabs/scte104 的常见问题

@astronautlabs/scte104 是什么?

Implementation of the SCTE-104 TCP/IP protocol

如何安装 @astronautlabs/scte104?

在项目目录运行 npm install @astronautlabs/scte104,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 scte104,可以用 npx scte104 直接运行。

@astronautlabs/scte104 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@astronautlabs/scte104 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@astronautlabs/scte104 可以商用吗?

@astronautlabs/scte104 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@astronautlabs/scte104 的下载量有多少?

根据 npm 官方下载统计,@astronautlabs/scte104 在 2026/10/07 – 2026/11/05 这 30 天内被下载 2,438 次,日均约 81 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@astronautlabs/scte104 还在维护吗?

最新版本 1.0.1 发布于 2024/01/20(2 年前);至今共发布 26 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/04/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。