@livepeer/core-web
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -5,2 +5,3 @@ import { MediaControllerStore } from '@livepeer/core/media'; | ||
type BroadcastStatus = "live" | "pending" | "idle"; | ||
type AudioDeviceId = "default" | `ID${string}`; | ||
@@ -120,2 +121,4 @@ type VideoDeviceId = "default" | "screen" | `ID${string}`; | ||
peerConnection: RTCPeerConnection | null; | ||
/** The status of the current broadcast. */ | ||
status: BroadcastStatus; | ||
/** | ||
@@ -144,2 +147,3 @@ * The WHIP ingest URL to use for the broadcast. | ||
setPeerConnection: (peerConnection: RTCPeerConnection) => void; | ||
setStatus: (status: BroadcastStatus) => void; | ||
setMediaDeviceIds: (mediaDevices: Partial<MediaDeviceIds>) => void; | ||
@@ -179,2 +183,2 @@ toggleAudio: () => void; | ||
export { type AudioDeviceId, type BroadcastAriaText, type BroadcastControlsState, type BroadcastDeviceInformation, type BroadcastState, type BroadcastStore, type InitialBroadcastProps, type MediaDeviceIds, type MediaDeviceInfoExtended, type VideoDeviceId, addBroadcastEventListeners, createBroadcastStore, getBroadcastDeviceInfo }; | ||
export { type AudioDeviceId, type BroadcastAriaText, type BroadcastControlsState, type BroadcastDeviceInformation, type BroadcastState, type BroadcastStatus, type BroadcastStore, type InitialBroadcastProps, type MediaDeviceIds, type MediaDeviceInfoExtended, type VideoDeviceId, addBroadcastEventListeners, createBroadcastStore, getBroadcastDeviceInfo }; |
@@ -419,2 +419,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
enabled: initialProps?.forceEnabled ?? false, | ||
status: "idle", | ||
mediaStream: null, | ||
@@ -539,2 +540,5 @@ mediaDevices: null, | ||
})), | ||
setStatus: (status)=>set(()=>({ | ||
status | ||
})), | ||
setMediaDeviceIds: (newMediaDeviceIds)=>set(({ mediaDeviceIds })=>({ | ||
@@ -675,8 +679,6 @@ mediaDeviceIds: { | ||
const destroyMediaSyncMounted = mediaStore.subscribe(({ mounted })=>mounted, async (mounted)=>{ | ||
if (mounted) { | ||
// we use setState here so it's clear this isn't an external function | ||
store.setState({ | ||
mounted: true | ||
}); | ||
} | ||
// we use setState here so it's clear this isn't an external function | ||
store.setState({ | ||
mounted | ||
}); | ||
}); | ||
@@ -710,6 +712,7 @@ // Subscribe to sync the error states | ||
/** STORE LISTENERS - handle broadcast state */ // Subscribe to request user media | ||
const destroyWhip = store.subscribe(({ enabled, ingestUrl, __controls, __initialProps })=>({ | ||
const destroyWhip = store.subscribe(({ enabled, ingestUrl, __controls, mounted })=>({ | ||
enabled, | ||
ingestUrl, | ||
requestedForceRenegotiateLastTime: __controls.requestedForceRenegotiateLastTime | ||
requestedForceRenegotiateLastTime: __controls.requestedForceRenegotiateLastTime, | ||
mounted | ||
}), async ({ enabled, ingestUrl })=>{ | ||
@@ -731,2 +734,3 @@ await cleanupWhip?.(); | ||
}; | ||
store.getState().__controlsFunctions.setStatus("pending"); | ||
const { destroy } = createNewWHIP({ | ||
@@ -736,9 +740,9 @@ ingestUrl, | ||
callbacks: { | ||
onRTCPeerConnection: (peerConnection)=>{ | ||
store.getState().__controlsFunctions.setPeerConnection(peerConnection); | ||
}, | ||
onConnected: ()=>{ | ||
mediaStore.getState().__controlsFunctions.setLive(true); | ||
store.getState().__controlsFunctions.setStatus("live"); | ||
mediaStore.getState().__controlsFunctions.onError(null); | ||
}, | ||
onRTCPeerConnection: (peerConnection)=>{ | ||
store.getState().__controlsFunctions.setPeerConnection(peerConnection); | ||
}, | ||
onError: onErrorComposed | ||
@@ -751,5 +755,6 @@ }, | ||
destroy?.(); | ||
store.getState().__controlsFunctions.setStatus("idle"); | ||
}; | ||
}, { | ||
equalityFn: (a, b)=>a.requestedForceRenegotiateLastTime === b.requestedForceRenegotiateLastTime && a.ingestUrl === b.ingestUrl && a.enabled === b.enabled | ||
equalityFn: (a, b)=>a.requestedForceRenegotiateLastTime === b.requestedForceRenegotiateLastTime && a.ingestUrl === b.ingestUrl && a.enabled === b.enabled && a.mounted === b.mounted | ||
}); | ||
@@ -756,0 +761,0 @@ // Subscribe to request user media |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"repository": { | ||
@@ -113,3 +113,3 @@ "type": "git", | ||
"zustand": "^4.5.0", | ||
"@livepeer/core": "3.0.2" | ||
"@livepeer/core": "3.0.3" | ||
}, | ||
@@ -116,0 +116,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
278449
6121
+ Added@livepeer/core@3.0.3(transitive)
- Removed@livepeer/core@3.0.2(transitive)
Updated@livepeer/core@3.0.3