basic demo
This commit is contained in:
12
examples/example-1.js
Normal file
12
examples/example-1.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import {RtmpPush} from '../dist/node/index.js';
|
||||||
|
|
||||||
|
const mediaSourceUri = 'https://storage.googleapis.com/phenix-testing-assets/NFL/nfl-h264-constrained-baseline-1920x1080p-cbr-10000kbps-29.97fps-aac-lc-255kbps-0h5m0s.mp4';
|
||||||
|
const streamKey = 'K4KZAlSyqPwyunGIbI7JEajen44S1V6xK37FAVhsVqqiGWoGI7DuJOR1ylortFffInHEZ2juAWQqUA2EIFD59uacryVgRnfB';
|
||||||
|
const ingestUri = `rtmp://ingest-stg.phenixrts.com:80/ingest/${streamKey}`;
|
||||||
|
|
||||||
|
const rtmpPush = new RtmpPush(mediaSourceUri, ingestUri).start(mediaSourceUri, ['multi-bitrate', 'fhd']);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
rtmpPush.stop();
|
||||||
|
|
||||||
|
}, 60_000)
|
||||||
@@ -6,8 +6,11 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"test:watch": "bun test --watch",
|
"test:watch": "bun test --watch",
|
||||||
"test:coverage": "bun test --coverage"
|
"test:coverage": "bun test --coverage",
|
||||||
},
|
"ci-build": "bun run build:node && bun run build:browser",
|
||||||
|
"build:node": "bun build src/index.ts --outdir dist/node --target node --format esm --minify --production",
|
||||||
|
"build:browser": "bun build src/index.ts --outdir dist/browser --target browser --format esm --minify --production"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "latest",
|
"@types/bun": "latest",
|
||||||
"@types/node": "^20.0.0"
|
"@types/node": "^20.0.0"
|
||||||
|
|||||||
@@ -18,11 +18,10 @@ export class RtmpPush {
|
|||||||
return this._mediaSourceUri;
|
return this._mediaSourceUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public start(streamKey: string, capabilities: string[]): this {
|
public start(): this {
|
||||||
// Use the constructor parameters instead of hardcoded values
|
// Use the constructor parameters instead of hardcoded values
|
||||||
const mediaSourceUri = this._mediaSourceUri;
|
const mediaSourceUri = this._mediaSourceUri;
|
||||||
const ingestUri = `${this._rtmpIngestUri}/${streamKey};capabilities=${capabilities.join(',')};tags=`;
|
const ingestUri = this._rtmpIngestUri;
|
||||||
|
|
||||||
const command = [
|
const command = [
|
||||||
'ffmpeg',
|
'ffmpeg',
|
||||||
'-re',
|
'-re',
|
||||||
|
|||||||
Reference in New Issue
Block a user