alicloud-apsara
v0.0.7
Published
A library for AliCloud live-streaming platform - Apsara
Downloads
251
Maintainers
Readme
alicloud-apsara
This is a library for integrating with AliCloud live-streaming platform - Apsara.
Integration progress:
- [x] get domains
- [x] generate ingest/streaming url with signature
- [x] forbid ingest url
- [ ] TBD
How to use
import { Apsara, ApsaraDomainsData } from 'alicloud-apsara'
const apsara = new Apsara({
accessKeyId: 'keyId',
accessKeySecret: 'keySecret'
})
// fetch domains from apsara
const domainsData: ApsaraDomainsData = await apsara.getDomains()
// Domains: {
// PageData: [
// {
// Description: '',
// LiveDomainStatus: 'online',
// DomainName: 'live-ingest.upstra-china.cc',
// LiveDomainType: 'liveEdge',
// RegionName: 'ap-southeast-1',
// GmtModified: '2020-09-14T14:31:23Z',
// GmtCreated: '2020-09-14T14:27:06Z',
// Cname: 'live-ingest.upstra-china.cc.w.alikunlun.com'
// }
// ]
// },
// TotalCount: 8,
// RequestId: '0500D05A-505D-49B1-B989-BDC9FDAB9BAD',
// PageSize: 20,
// PageNumber: 1
// forbid a streaming
const res: ApsaraResponseData = await apsara.terminateStreamingUrl({
domain: 'test',
appName: 'test',
streamName: 'test',
oneshot: 'yes', // 'yes'/'no', yes - only forbid without adding to blacklist
resumeTime: '2021-02-24T17:59:19Z'
})
// RequestId: '0500D05A-505D-49B1-B989-BDC9FDAB9BAD',
Specs
Apsara(options [,logger])
- options, required
accessKeyId
: string, requiredaccessKeySecret
: string, requiredbaseUrl
?: string, by default'https://live.aliyuncs.com'
timeout
?: number, by default3000
version
?: string, by default'2016-11-01'
signatureMethod
?: string, by default'HMAC-SHA1'
signatureVersion
?: string, by default'1.0'
format
?: string, by default'json'
- logger, optional, WinstonLogger/BunyanLogger/Console
Methods (TBD)
- Apsara.getDomains()
- Apsara.getIngestUrl({ domain: string appName: string streamName: string expiredIn: number key: string })
- Apsara.getVideoStreamingUrl({ domain: string appName: string streamName: string expiredIn: number // seconds key: string format: string // 'rtmp' | 'flv' | 'm3u8' | 'udp' isSecure: boolean })
- Apsara.terminateStreamingUrl({ domain: string appName: string streamName: string oneshot?: string resumeTime?: string // "yyyy-MM-dd'T'HH:mm:ss'Z'" })
How to test
yarn
yarn test