diff --git a/examples/example-1.js b/examples/example-1.js new file mode 100644 index 0000000..6427fef --- /dev/null +++ b/examples/example-1.js @@ -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) diff --git a/package.json b/package.json index 770edbb..d17aa8c 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,11 @@ "scripts": { "test": "bun test", "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": { "@types/bun": "latest", "@types/node": "^20.0.0" diff --git a/src/RtmpPush.ts b/src/RtmpPush.ts index d0d07a7..d368e80 100644 --- a/src/RtmpPush.ts +++ b/src/RtmpPush.ts @@ -18,11 +18,10 @@ export class RtmpPush { return this._mediaSourceUri; } - public start(streamKey: string, capabilities: string[]): this { + public start(): this { // Use the constructor parameters instead of hardcoded values const mediaSourceUri = this._mediaSourceUri; - const ingestUri = `${this._rtmpIngestUri}/${streamKey};capabilities=${capabilities.join(',')};tags=`; - + const ingestUri = this._rtmpIngestUri; const command = [ 'ffmpeg', '-re',