https://github.com/rbndg/bitstation-client
https://github.com/rbndg/bitstation-client
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rbndg/bitstation-client
- Owner: rbndg
- Created: 2020-05-26T23:31:12.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-26T23:31:53.000Z (almost 5 years ago)
- Last Synced: 2024-10-05T16:21:46.394Z (8 months ago)
- Language: HTML
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bitstation Client
Use this client to connect, purchase, decode Bitstartion streams.
## Features
* Pay for Bitstation streams
* Deserialise stream into HLS segment and playlist.
* HLS server to watch stream on any HLS viewer (Web, VLC, Quicktime..etc)### Requirements
* Lightning Network wallet to pay for a stream.
## How to watch now
You can start watching streams with the provided index.js
```js
// First setup of config.json.
node conenct.js
// When stream is connected and ready, you can use any HLS compatible video player to start watching stream.```
---
## API#### `const dazaar = new Dazzar(config)`
Streamer class deals with broadcasting data to Dazaar and handling payment processing
``` js
const config = {
HLS_SERVER:'http://localhost:8021', // HLS server for watching the stream
STREAM_COST: 10, // Cost of stream in Sats per second (Get this value from broadcaster)
MENU: [1, 10, 60, 90, 120], // Array of minutes of streaming you want to pay for
}```
#### `dazaar.on('stream-data',mediaBinary)`
Binary media data from dazaar stream#### `dazaar.on('stream-invalid')`
You have no access to the stream, you must subscribe#### `dazaar.on('stream-invalid')`
You have no access to the stream, you must subscribe to stream#### `dazaar.on('stream-validate')`
You have access to stream to start deserialising.#### `dazaar.buy(sats)`
Request a invoice from some `satoshi` amounts from broadcaster.#### `dazaar.startStream(config)`
Start deserialisng from a position. When data starts flowing `stream-data` will be calledd``` js
Optional Config
{
start : 0 // Position where to start streaming.
// 0 = start from the beginning stream. Good for watching VOD content.
// Leave config as undefined for watching Live content
}
```----
#### `const hls = new HLS(config)`
HLS class will deserialise stream and serve the content
``` js
{
"PLAYLIST_PATH" : "./.playlist", //Folder where the HLS output is saved
"PLAYLIST_FILE" : "output.m3u8", //Name of playlist file
}
```#### `hls.init(cb)`
Delete current playlist directory and create empty playlist file.#### `hls.startHLS()`
Start HLS Server for serving the video.#### `hls.appendData(data)`
Decoded Dazaar data for updating playlist file and creating segment files.-----
### Related Packages
**Bitstation server** : Broadcasting and charging for videos.**Bitstation client** : Connect to a stream, decode and purchase videos.
**Bitstation player** : Simple video client GUI built on top of Bitstation client.