Skip to content

Commit

Permalink
fix: no video in multi-source stream when main source id is not null (#…
Browse files Browse the repository at this point in the history
…465)

* fix: no video in multi-source stream when main source id is not null

* bump RC version and added changeset
  • Loading branch information
vincentsong authored Oct 24, 2024
1 parent 6af9c59 commit 9d54c92
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-cats-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@millicast/sdk": patch
---

fixed bug: no video when the main source id is not null
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/millicast-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@millicast/sdk",
"version": "0.3.0-RC-11",
"version": "0.3.0-RC-12",
"description": "SDK for building a realtime broadcaster using the Millicast platform.",
"keywords": [
"sdk",
Expand Down
2 changes: 1 addition & 1 deletion packages/millicast-sdk/src/Signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default class Signaling extends EventEmitter {
sdp = SdpParser.adaptCodecName(sdp, 'AV1X', VideoCodec.AV1)

// default events
const events = ['active', 'inative', 'layers', 'viewercount', 'vad', 'updated', 'migrate', 'stopped']
const events = ['active', 'inactive', 'layers', 'viewercount', 'vad', 'updated', 'migrate', 'stopped']
const data = { sdp, streamId: this.streamName, pinnedSourceId: optionsParsed.pinnedSourceId, excludedSourceIds: optionsParsed.excludedSourceIds, events }

if (optionsParsed.vad) { data.vad = true }
Expand Down
39 changes: 18 additions & 21 deletions packages/millicast-sdk/src/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,28 +301,25 @@ export default class View extends BaseWebRTC {
})

signalingInstance.on(signalingEvents.broadcastEvent, async (event) => {
if (event.data.sourceId === null) {
switch (event.name) {
case 'active':
if (this.DRMProfile == null) {
const subscriberData = await this.tokenGenerator()
if (subscriberData.drmObject) {
// cache the DRM license server URLs
this.DRMProfile = subscriberData.drmObject
}
}
this.emit(signalingEvents.broadcastEvent, event)
this.isMainStreamActive = true
while (this.eventQueue.length > 0) {
this.onTrackEvent(this.eventQueue.shift())
}
return
case 'inactive':
this.isMainStreamActive = false
break
default:
break
if (!this.isMainStreamActive && event.name === 'active') {
// handle 'active' event for main stream
this.mainSourceId = event.data.sourceId
if (!this.DRMProfile && event.data.encryption) {
const subscriberData = await this.tokenGenerator()
if (subscriberData.drmObject) {
// cache the DRM license server URLs
this.DRMProfile = subscriberData.drmObject
}
}
this.emit(signalingEvents.broadcastEvent, event)
this.isMainStreamActive = true
while (this.eventQueue.length > 0) {
this.onTrackEvent(this.eventQueue.shift())
}
return
}
if (event.name === 'inactive' && this.isMainStreamActive && this.mainSourceId === event.data.sourceId) {
this.isMainStreamActive = false
}
this.emit(signalingEvents.broadcastEvent, event)
})
Expand Down
3 changes: 0 additions & 3 deletions packages/millicast-viewer-demo/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ const newViewer = () => {
millicastView.configureDRM(drmOptions);
}
}
let layers = event.data["layers"] !== null ? event.data["layers"] : {};
if (event.name === "layers" && Object.keys(layers).length <= 0) {
}
});
millicastView.on("track", (event) => {
if (!enableDRM) addStream(event.streams[0]);
Expand Down

0 comments on commit 9d54c92

Please sign in to comment.