eyevinn-channel-engine 3.3.10 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.github/workflows/publish.yml +5 -3
  2. package/dist/engine/ad_request.d.ts +14 -0
  3. package/dist/engine/ad_request.js +121 -0
  4. package/dist/engine/chaos_monkey.d.ts +1 -0
  5. package/dist/engine/chaos_monkey.js +55 -0
  6. package/dist/engine/event_stream.d.ts +6 -0
  7. package/dist/engine/event_stream.js +20 -0
  8. package/dist/engine/index.d.ts +0 -0
  9. package/dist/engine/index.js +0 -0
  10. package/dist/engine/memcached_state_store.d.ts +12 -0
  11. package/dist/engine/memcached_state_store.js +164 -0
  12. package/dist/engine/memory_state_store.d.ts +11 -0
  13. package/dist/engine/memory_state_store.js +105 -0
  14. package/dist/engine/playhead_state.d.ts +26 -0
  15. package/dist/engine/playhead_state.js +156 -0
  16. package/dist/engine/redis_state_store.d.ts +12 -0
  17. package/dist/engine/redis_state_store.js +236 -0
  18. package/dist/engine/server.d.ts +125 -0
  19. package/dist/engine/server.js +1113 -0
  20. package/dist/engine/session.d.ts +109 -0
  21. package/dist/engine/session.js +2194 -0
  22. package/dist/engine/session_live.d.ts +119 -0
  23. package/dist/engine/session_live.js +1723 -0
  24. package/dist/engine/session_live_state.d.ts +24 -0
  25. package/dist/engine/session_live_state.js +231 -0
  26. package/dist/engine/session_state.d.ts +45 -0
  27. package/dist/engine/session_state.js +365 -0
  28. package/dist/engine/shared_state_store.d.ts +21 -0
  29. package/dist/engine/shared_state_store.js +170 -0
  30. package/dist/engine/stream_switcher.d.ts +29 -0
  31. package/dist/engine/stream_switcher.js +813 -0
  32. package/dist/engine/util.d.ts +19 -0
  33. package/dist/engine/util.js +281 -0
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +5 -0
  36. package/dist/package.json +47 -0
  37. package/dist/server-demux.d.ts +1 -0
  38. package/dist/server-demux.js +103 -0
  39. package/dist/server-livemix.d.ts +1 -0
  40. package/dist/server-livemix.js +196 -0
  41. package/dist/server.d.ts +1 -0
  42. package/dist/server.js +101 -0
  43. package/engine/index.ts +0 -0
  44. package/engine/{server.js → server.ts} +128 -6
  45. package/engine/session.js +189 -174
  46. package/index.ts +12 -0
  47. package/package.json +11 -7
  48. package/{server-demux.js → server-demux.ts} +16 -10
  49. package/{server-livemix.js → server-livemix.ts} +21 -13
  50. package/{server.js → server.ts} +13 -8
  51. package/spec/engine/engine_spec.js +1 -1
  52. package/spec/engine/interface_spec.js +1 -1
  53. package/tsconfig.json +10 -0
  54. package/index.js +0 -3
@@ -0,0 +1,156 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (_) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ var SharedStateStore = require('./shared_state_store.js');
53
+ var PlayheadState = Object.freeze({
54
+ RUNNING: 1,
55
+ STOPPED: 2,
56
+ CRASHED: 3,
57
+ IDLE: 4
58
+ });
59
+ var SharedPlayheadState = /** @class */ (function () {
60
+ function SharedPlayheadState(store, sessionId, opts) {
61
+ this.sessionId = sessionId;
62
+ this.store = store;
63
+ this.state = PlayheadState.IDLE;
64
+ this.lastM3u8 = null;
65
+ }
66
+ SharedPlayheadState.prototype.get = function (key) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4 /*yield*/, this.store.get(this.sessionId, key)];
71
+ case 1: return [2 /*return*/, _a.sent()];
72
+ }
73
+ });
74
+ });
75
+ };
76
+ SharedPlayheadState.prototype.getState = function () {
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ return __generator(this, function (_a) {
79
+ return [2 /*return*/, this.state];
80
+ });
81
+ });
82
+ };
83
+ SharedPlayheadState.prototype.getLastM3u8 = function () {
84
+ return __awaiter(this, void 0, void 0, function () {
85
+ return __generator(this, function (_a) {
86
+ return [2 /*return*/, this.lastM3u8];
87
+ });
88
+ });
89
+ };
90
+ SharedPlayheadState.prototype.getValues = function (keys) {
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, this.store.getValues(this.sessionId, keys)];
95
+ case 1: return [2 /*return*/, _a.sent()];
96
+ }
97
+ });
98
+ });
99
+ };
100
+ SharedPlayheadState.prototype.set = function (key, value) {
101
+ return __awaiter(this, void 0, void 0, function () {
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0: return [4 /*yield*/, this.store.set(this.sessionId, key, value)];
105
+ case 1: return [2 /*return*/, _a.sent()];
106
+ }
107
+ });
108
+ });
109
+ };
110
+ SharedPlayheadState.prototype.setState = function (newState) {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ return __generator(this, function (_a) {
113
+ this.state = newState;
114
+ return [2 /*return*/, this.state];
115
+ });
116
+ });
117
+ };
118
+ SharedPlayheadState.prototype.setLastM3u8 = function (m3u8) {
119
+ return __awaiter(this, void 0, void 0, function () {
120
+ return __generator(this, function (_a) {
121
+ this.lastM3u8 = m3u8;
122
+ return [2 /*return*/, this.lastM3u8];
123
+ });
124
+ });
125
+ };
126
+ return SharedPlayheadState;
127
+ }());
128
+ var PlayheadStateStore = /** @class */ (function (_super) {
129
+ __extends(PlayheadStateStore, _super);
130
+ function PlayheadStateStore(opts) {
131
+ return _super.call(this, "playhead", opts, {
132
+ state: PlayheadState.IDLE,
133
+ tickInterval: 3,
134
+ mediaSeq: 0,
135
+ vodMediaSeqVideo: 0,
136
+ vodMediaSeqAudio: 0,
137
+ }) || this;
138
+ }
139
+ PlayheadStateStore.prototype.create = function (sessionId) {
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ return __generator(this, function (_a) {
142
+ switch (_a.label) {
143
+ case 0: return [4 /*yield*/, this.init(sessionId)];
144
+ case 1:
145
+ _a.sent();
146
+ return [2 /*return*/, new SharedPlayheadState(this, sessionId)];
147
+ }
148
+ });
149
+ });
150
+ };
151
+ return PlayheadStateStore;
152
+ }(SharedStateStore));
153
+ module.exports = {
154
+ PlayheadState: PlayheadState,
155
+ PlayheadStateStore: PlayheadStateStore
156
+ };
@@ -0,0 +1,12 @@
1
+ export = RedisStateStore;
2
+ declare class RedisStateStore {
3
+ constructor(keyPrefix: any, opts: any);
4
+ keyPrefix: any;
5
+ client: any;
6
+ initAsync(id: any, initData: any): Promise<{}>;
7
+ resetAsync(id: any, initData: any): Promise<void>;
8
+ getAsync(id: any, key: any): Promise<any>;
9
+ setAsync(id: any, key: any, value: any): Promise<any>;
10
+ setVolatileAsync(id: any, key: any, value: any): Promise<any>;
11
+ removeAsync(id: any, key: any): Promise<void>;
12
+ }
@@ -0,0 +1,236 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var redis = require("redis");
38
+ var debug = require("debug")("redis-state-store");
39
+ var VOLATILE_KEY_TTL = 5; // Timeout so it should not expire within one normal increment iteration (in seconds)
40
+ var RedisStateStore = /** @class */ (function () {
41
+ function RedisStateStore(keyPrefix, opts) {
42
+ this.keyPrefix = keyPrefix;
43
+ if (opts.version) {
44
+ var prependPrefix = opts.version.replace(/\./g, "X");
45
+ this.keyPrefix = prependPrefix + this.keyPrefix;
46
+ debug("Prepending keyprefix with ".concat(prependPrefix, " => ").concat(this.keyPrefix));
47
+ }
48
+ this.client = redis.createClient(opts.redisUrl);
49
+ }
50
+ RedisStateStore.prototype.initAsync = function (id, initData) {
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var isInitiated, data, _i, _a, key, _b, _c, _d, _e, key, _f, _g;
53
+ return __generator(this, function (_h) {
54
+ switch (_h.label) {
55
+ case 0: return [4 /*yield*/, this.getAsync(id, "_initiated")];
56
+ case 1:
57
+ isInitiated = _h.sent();
58
+ data = {};
59
+ if (!!isInitiated) return [3 /*break*/, 7];
60
+ _i = 0, _a = Object.keys(initData);
61
+ _h.label = 2;
62
+ case 2:
63
+ if (!(_i < _a.length)) return [3 /*break*/, 5];
64
+ key = _a[_i];
65
+ debug("".concat(this.keyPrefix, ":").concat(id, ": Initiating key ").concat(key, " with init data"));
66
+ _b = data;
67
+ _c = key;
68
+ return [4 /*yield*/, this.setAsync(id, key, initData[key])];
69
+ case 3:
70
+ _b[_c] = _h.sent();
71
+ _h.label = 4;
72
+ case 4:
73
+ _i++;
74
+ return [3 /*break*/, 2];
75
+ case 5: return [4 /*yield*/, this.setAsync(id, "_initiated", true)];
76
+ case 6:
77
+ _h.sent();
78
+ return [3 /*break*/, 11];
79
+ case 7:
80
+ debug("".concat(this.keyPrefix, ":").concat(id, ": Already initiated, not initiating with init data"));
81
+ _d = 0, _e = Object.keys(initData);
82
+ _h.label = 8;
83
+ case 8:
84
+ if (!(_d < _e.length)) return [3 /*break*/, 11];
85
+ key = _e[_d];
86
+ debug("".concat(this.keyPrefix, ":").concat(id, ": Initiating key ").concat(key, " with data from store"));
87
+ _f = data;
88
+ _g = key;
89
+ return [4 /*yield*/, this.getAsync(id, key)];
90
+ case 9:
91
+ _f[_g] = _h.sent();
92
+ _h.label = 10;
93
+ case 10:
94
+ _d++;
95
+ return [3 /*break*/, 8];
96
+ case 11: return [2 /*return*/, data];
97
+ }
98
+ });
99
+ });
100
+ };
101
+ RedisStateStore.prototype.resetAsync = function (id, initData) {
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ var resetAsync;
104
+ var _this = this;
105
+ return __generator(this, function (_a) {
106
+ switch (_a.label) {
107
+ case 0:
108
+ resetAsync = new Promise(function (resolve, reject) {
109
+ _this.client.flushall(function (err, reply) {
110
+ if (!err) {
111
+ console.log("Flushed Redis db: ", reply);
112
+ resolve();
113
+ }
114
+ else {
115
+ reject(err);
116
+ }
117
+ });
118
+ });
119
+ return [4 /*yield*/, resetAsync];
120
+ case 1:
121
+ _a.sent();
122
+ return [2 /*return*/];
123
+ }
124
+ });
125
+ });
126
+ };
127
+ RedisStateStore.prototype.getAsync = function (id, key) {
128
+ return __awaiter(this, void 0, void 0, function () {
129
+ var storeKey, getAsync, data;
130
+ var _this = this;
131
+ return __generator(this, function (_a) {
132
+ switch (_a.label) {
133
+ case 0:
134
+ storeKey = "" + this.keyPrefix + id + key;
135
+ getAsync = new Promise(function (resolve, reject) {
136
+ _this.client.get(storeKey, function (err, reply) {
137
+ debug("REDIS get ".concat(storeKey, ":").concat(reply ? reply.length + " chars" : "null"));
138
+ if (!err) {
139
+ resolve(JSON.parse(reply));
140
+ }
141
+ else {
142
+ reject(err);
143
+ }
144
+ });
145
+ });
146
+ return [4 /*yield*/, getAsync];
147
+ case 1:
148
+ data = _a.sent();
149
+ return [2 /*return*/, data];
150
+ }
151
+ });
152
+ });
153
+ };
154
+ RedisStateStore.prototype.setAsync = function (id, key, value) {
155
+ return __awaiter(this, void 0, void 0, function () {
156
+ var storeKey, setAsync;
157
+ var _this = this;
158
+ return __generator(this, function (_a) {
159
+ switch (_a.label) {
160
+ case 0:
161
+ storeKey = "" + this.keyPrefix + id + key;
162
+ setAsync = new Promise(function (resolve, reject) {
163
+ _this.client.set(storeKey, JSON.stringify(value), function (err, res) {
164
+ debug("REDIS set ".concat(storeKey, ": ").concat(res));
165
+ if (!err) {
166
+ resolve(value);
167
+ }
168
+ else {
169
+ reject(err);
170
+ }
171
+ });
172
+ });
173
+ return [4 /*yield*/, setAsync];
174
+ case 1: return [2 /*return*/, _a.sent()];
175
+ }
176
+ });
177
+ });
178
+ };
179
+ RedisStateStore.prototype.setVolatileAsync = function (id, key, value) {
180
+ return __awaiter(this, void 0, void 0, function () {
181
+ var data, storeKey, expireAsync;
182
+ var _this = this;
183
+ return __generator(this, function (_a) {
184
+ switch (_a.label) {
185
+ case 0: return [4 /*yield*/, this.setAsync(id, key, value)];
186
+ case 1:
187
+ data = _a.sent();
188
+ storeKey = "" + this.keyPrefix + id + key;
189
+ expireAsync = new Promise(function (resolve, reject) {
190
+ _this.client.expire(storeKey, VOLATILE_KEY_TTL, function (err, res) {
191
+ if (!err) {
192
+ debug("REDIS expire ".concat(storeKey, " ").concat(VOLATILE_KEY_TTL, "s: ").concat(res === 1 ? "OK" : "KEY DOES NOT EXIST"));
193
+ resolve();
194
+ }
195
+ else {
196
+ reject(err);
197
+ }
198
+ });
199
+ });
200
+ return [4 /*yield*/, expireAsync];
201
+ case 2:
202
+ _a.sent();
203
+ return [2 /*return*/, data];
204
+ }
205
+ });
206
+ });
207
+ };
208
+ RedisStateStore.prototype.removeAsync = function (id, key) {
209
+ return __awaiter(this, void 0, void 0, function () {
210
+ var storeKey, delAsync;
211
+ var _this = this;
212
+ return __generator(this, function (_a) {
213
+ switch (_a.label) {
214
+ case 0:
215
+ storeKey = "" + this.keyPrefix + id + key;
216
+ delAsync = new Promise(function (resolve, reject) {
217
+ _this.client.del(storeKey, function (err, res) {
218
+ if (!err) {
219
+ resolve();
220
+ }
221
+ else {
222
+ reject(err);
223
+ }
224
+ });
225
+ });
226
+ return [4 /*yield*/, delAsync];
227
+ case 1:
228
+ _a.sent();
229
+ return [2 /*return*/];
230
+ }
231
+ });
232
+ });
233
+ };
234
+ return RedisStateStore;
235
+ }());
236
+ module.exports = RedisStateStore;
@@ -0,0 +1,125 @@
1
+ export interface ChannelEngineOpts {
2
+ defaultSlateUri?: string;
3
+ slateRepetitions?: number;
4
+ slateDuration?: number;
5
+ redisUrl?: string;
6
+ memcachedUrl?: string;
7
+ sharedStoreCacheTTL?: number;
8
+ heartbeat?: string;
9
+ channelManager: IChannelManager;
10
+ streamSwitchManager?: IStreamSwitchManager;
11
+ cacheTTL?: number;
12
+ playheadDiffThreshold?: number;
13
+ maxTickInterval?: number;
14
+ cloudWatchMetrics?: boolean;
15
+ useDemuxedAudio?: boolean;
16
+ alwaysNewSegments?: boolean;
17
+ diffCompensationRate?: number;
18
+ staticDirectory?: string;
19
+ averageSegmentDuration?: number;
20
+ targetDurationPadding?: boolean;
21
+ forceTargetDuration?: boolean;
22
+ adCopyMgrUri?: string;
23
+ adXchangeUri?: string;
24
+ }
25
+ export interface VodRequest {
26
+ sessionId: string;
27
+ category?: string;
28
+ playlistId: string;
29
+ }
30
+ export interface VodResponseMetadata {
31
+ id: string;
32
+ title: string;
33
+ }
34
+ export interface VodTimedMetadata {
35
+ 'start-date': string;
36
+ }
37
+ export interface VodResponse {
38
+ uri: string;
39
+ currentMetadata?: VodResponseMetadata;
40
+ timedMetadata?: VodTimedMetadata;
41
+ }
42
+ export interface IAssetManager {
43
+ getNextVod: (vodRequest: VodRequest) => Promise<VodResponse>;
44
+ }
45
+ export interface ChannelProfile {
46
+ bw: number;
47
+ codecs: string;
48
+ resolution: number[];
49
+ }
50
+ export interface Channel {
51
+ id: string;
52
+ profile: ChannelProfile[];
53
+ audioTracks?: AudioTracks[];
54
+ }
55
+ export interface AudioTracks {
56
+ language: string;
57
+ name: string;
58
+ default?: boolean;
59
+ }
60
+ export interface IChannelManager {
61
+ getChannels: () => Channel[];
62
+ }
63
+ export declare enum ScheduleStreamType {
64
+ LIVE = 1,
65
+ VOD = 2
66
+ }
67
+ export interface Schedule {
68
+ eventId: string;
69
+ assetId: string;
70
+ title: string;
71
+ type: ScheduleStreamType;
72
+ start_time: number;
73
+ end_time: number;
74
+ uri: string;
75
+ duration?: number;
76
+ }
77
+ export interface IStreamSwitchManager {
78
+ generateID: () => string;
79
+ getPrerollUri: (channelId: string) => Promise<string>;
80
+ getSchedule: (channelId: string) => Promise<Schedule>;
81
+ }
82
+ export declare class ChannelEngine {
83
+ private options?;
84
+ private useDemuxedAudio;
85
+ private alwaysNewSegments;
86
+ private defaultSlateUri?;
87
+ private slateDuration?;
88
+ private assetMgr;
89
+ private streamSwitchManager?;
90
+ private slateRepetitions?;
91
+ private monitorTimer;
92
+ private server;
93
+ private serverStartTime;
94
+ private instanceId;
95
+ private streamSwitchTimeIntervalMs;
96
+ private sessionStore;
97
+ private sessionLiveStore;
98
+ private streamerOpts;
99
+ private logCloudWatchMetrics;
100
+ private adCopyMgrUri?;
101
+ private adXchangeUri?;
102
+ constructor(assetMgr: IAssetManager, options?: ChannelEngineOpts);
103
+ updateStreamSwitchAsync(): Promise<void>;
104
+ updateChannelsAsync(channelMgr: any, options: any): Promise<void>;
105
+ start(): void;
106
+ listen(port: any): void;
107
+ getStatusForSessionAsync(sessionId: any): Promise<any>;
108
+ getSessionCount(): number;
109
+ getPlayheadCount(): number;
110
+ _monitorAsync(session: any, sessionLive: any): Promise<void>;
111
+ getMasterManifest(channelId: any): Promise<any>;
112
+ getMediaManifests(channelId: any): Promise<{}>;
113
+ getAudioManifests(channelId: any): Promise<{}>;
114
+ _handleHeartbeat(req: any, res: any, next: any): void;
115
+ _handleMasterManifest(req: any, res: any, next: any): Promise<void>;
116
+ _handleAudioManifest(req: any, res: any, next: any): Promise<void>;
117
+ _handleMediaManifest(req: any, res: any, next: any): Promise<void>;
118
+ _handleEventStream(req: any, res: any, next: any): void;
119
+ _handleStatus(req: any, res: any, next: any): Promise<void>;
120
+ _handleAggregatedSessionHealth(req: any, res: any, next: any): Promise<void>;
121
+ _handleSessionHealth(req: any, res: any, next: any): Promise<void>;
122
+ _handleSessionReset(req: any, res: any, next: any): Promise<void>;
123
+ _gracefulErrorHandler(errMsg: any): any;
124
+ _errorHandler(errMsg: any): any;
125
+ }