eyevinn-channel-engine 3.0.3 → 3.0.4
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.
- package/README.md +3 -1
- package/engine/server.js +12 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,8 +141,9 @@ class MyStreamSwitchManager {
|
|
|
141
141
|
getSchedule(channelId) -> [ { eventId, assetId, title, type, start_time, end_time, uri, duration } ]
|
|
142
142
|
}
|
|
143
143
|
```
|
|
144
|
+
When using **Live Mixing** in **High-Availablilty** mode, it is important to know that the class's `getSchedule(channelId)` function will be called by each channel-engine instance. Meaning that it is crucial that the implementation of this function will return the same response for each and every channel-engine instance, as they are expecting to be recieving identical lists in order to be synced up for live mixing.
|
|
144
145
|
|
|
145
|
-
The class's `getSchedule(channelId)` function should return a list of
|
|
146
|
+
The class's `getSchedule(channelId)` function should return a promise containing the list of events as an object in the following format below:
|
|
146
147
|
|
|
147
148
|
```
|
|
148
149
|
{
|
|
@@ -208,6 +209,7 @@ Below are examples of a Live stream event and a VOD event respectively:
|
|
|
208
209
|
(*Important Note: When it comes to VOD events. Desired `duration` has priority over `end_time`. Meaning that you will only resume VOD2Live content after the asset in the VOD event has finished. This may change in the future.*)
|
|
209
210
|
|
|
210
211
|
|
|
212
|
+
|
|
211
213
|
Then create an instance of the class and reference it as the `streamSwitchManager` in your engineOptions, just like you'd do with the channel manager.
|
|
212
214
|
|
|
213
215
|
```
|
package/engine/server.js
CHANGED
|
@@ -167,12 +167,18 @@ class ChannelEngine {
|
|
|
167
167
|
|
|
168
168
|
const StreamSwitchLoop = async (timeIntervalMs) => {
|
|
169
169
|
while(true) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
try {
|
|
171
|
+
const ts_1 = Date.now();
|
|
172
|
+
await this.updateStreamSwitchAsync()
|
|
173
|
+
const ts_2 = Date.now();
|
|
174
|
+
let interval = (timeIntervalMs - (ts_2 - ts_1)) < 0 ? 50 : (timeIntervalMs - (ts_2 - ts_1));
|
|
175
|
+
await timer(interval)
|
|
176
|
+
debug(`StreamSwitchLoop waited for all channels. Next tick in: ${interval}ms`)
|
|
177
|
+
} catch (err) {
|
|
178
|
+
console.error(err)
|
|
179
|
+
debug(`StreamSwitchLoop iteration failed. Trying Again in 1000ms!`);
|
|
180
|
+
await timer(1000);
|
|
181
|
+
}
|
|
176
182
|
}
|
|
177
183
|
}
|
|
178
184
|
StreamSwitchLoop(this.streamSwitchTimeIntervalMs);
|