Giter Site home page Giter Site logo

scte104's Introduction

@/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

๐Ÿ“ Beta Quality
This library is new, no compatibility is currently guaranteed between releases (beta, semver 0.x.x).


Implementation of the SCTE-104 TCP/IP protocol in Typescript

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.

Client

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

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

scte104's People

Contributors

rezonant avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.