Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Eyevinn/hls-ts-js
HLS MPEG-TS parser library in Javascript
https://github.com/Eyevinn/hls-ts-js
hls mpeg streaming video
Last synced: 3 months ago
JSON representation
HLS MPEG-TS parser library in Javascript
- Host: GitHub
- URL: https://github.com/Eyevinn/hls-ts-js
- Owner: Eyevinn
- License: other
- Created: 2017-02-03T20:40:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-10T02:17:06.000Z (over 1 year ago)
- Last Synced: 2024-04-14T16:01:43.692Z (7 months ago)
- Topics: hls, mpeg, streaming, video
- Language: JavaScript
- Homepage: https://inspect.eyevinn.technology
- Size: 10.1 MB
- Stars: 36
- Watchers: 6
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-video - Eyevinn/hls-ts-js - HLS MPEG-TS parser library in Javascript. (HLS / Talks Presentations Podcasts)
README
[![Build Status](https://travis-ci.org/Eyevinn/hls-ts-js.svg?branch=master)](https://travis-ci.org/Eyevinn/hls-ts-js)
[![Coverage Status](https://coveralls.io/repos/github/Eyevinn/hls-ts-js/badge.svg?branch=master)](https://coveralls.io/github/Eyevinn/hls-ts-js?branch=master)A Javascript library to parse Apple HLS MPEG Transport Stream segments
## Usage (Node JS)
```
npm install --save hls-ts
```The library implements the `Writable` stream interface and acts a a "sink". For example to download
and parse an HLS MPEG Transport Stream segment:```
const request = require("request");
const hlsTs = require("hls-ts");request.get("http://example.com/seg10.ts")
.pipe(hlsTs.parse())
.on("finish", function() {// Obtain all programs found in the Transport Stream
const programs = hlsTs.programs;// Obtain all packets for a specific program stream
const avcPackets = hlsTs.getPacketsByProgramType("avc");// Obtain the payload for a program stream
const avcPayload = hlsTs.getDataStreamByProgramType("avc");// where avcPayload.data is a Uint8Array
const avcParser = hlsTs.createAvcParser(avcPayload);// Obtain NAL units
const nalUnits = avcParser.getNalUnits();
});
```## Usage (Browser version)
```
var xhr = new XMLHttpRequest();
var url = "http://example.com/hls/seg-10s.ts";
var parser = new window.HlsTs({ debug: false });
xhr.responseType = "arraybuffer";
xhr.onloadend = function() {
var buffer = xhr.response;
var data = new Uint8Array(buffer);
parser.parse(data).then(function() {
// Obtain all programs found in the Transport Stream
var programs = parser.getPrograms();// Obtain all packets for a specific program stream
var avcPackets = parser.getPacketsByProgramType("avc");
// Obtain the payload for a program stream
var avcPayload = parser.getDataStreamByProgramType("avc");// where avcPayload.data is a Uint8Array
var avcParser = parser.createAvcParser(avcPayload);// Obtain NAL units
var nalUnits = avcParser.getNalUnits();
}).catch(function(err) { console.error(err.message); }).then(done);
};
xhr.open("GET", url);
xhr.send();```
## API Documentation
Find API documentation here: https://inspect.eyevinn.technology/docs/index.html
## Contributing
All contributions are welcome but before you submit a Pull Request make sure you follow the same
code conventions and that you have written unit tests## About Eyevinn Technology
Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor.
At Eyevinn, every software developer consultant has a dedicated budget reserved for open source development and contribution to the open source community. This give us room for innovation, team building and personal competence development. And also gives us as a company a way to contribute back to the open source community.
Want to know more about Eyevinn and how it is to work here. Contact us at [email protected]!