fixed resumeTrack method
This commit is contained in:
parent
a558ca069b
commit
c31b19a797
|
|
@ -75,13 +75,7 @@ export const TracksProvider = ({ children }) => {
|
||||||
const resumeVideoTrack = useCallback(
|
const resumeVideoTrack = useCallback(
|
||||||
(id) => {
|
(id) => {
|
||||||
// Ignore undefined, local or screenshare
|
// Ignore undefined, local or screenshare
|
||||||
if (
|
if (!id || isLocalId(id) || isScreenId(id)) return;
|
||||||
!id ||
|
|
||||||
isLocalId(id) ||
|
|
||||||
isScreenId(id) ||
|
|
||||||
rtcpeers.getCurrentType() !== 'sfu'
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const videoTrack = callObject.participants()?.[id]?.tracks?.video;
|
const videoTrack = callObject.participants()?.[id]?.tracks?.video;
|
||||||
if (!videoTrack?.subscribed) {
|
if (!videoTrack?.subscribed) {
|
||||||
|
|
@ -131,16 +125,9 @@ export const TracksProvider = ({ children }) => {
|
||||||
const isSubscribed =
|
const isSubscribed =
|
||||||
callObject.participants()?.[id]?.tracks?.video?.subscribed;
|
callObject.participants()?.[id]?.tracks?.video?.subscribed;
|
||||||
|
|
||||||
// Set resume state for newly subscribed tracks
|
/**
|
||||||
if (shouldSubscribe) {
|
* Pause already subscribed tracks.
|
||||||
rtcpeers.soup.setResumeOnSubscribeForTrack(
|
*/
|
||||||
id,
|
|
||||||
'cam-video',
|
|
||||||
!pausedIds.includes(id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pause already subscribed tracks
|
|
||||||
if (shouldSubscribe && shouldPause) {
|
if (shouldSubscribe && shouldPause) {
|
||||||
pauseVideoTrack(id);
|
pauseVideoTrack(id);
|
||||||
}
|
}
|
||||||
|
|
@ -149,8 +136,9 @@ export const TracksProvider = ({ children }) => {
|
||||||
isLocalId(id) ||
|
isLocalId(id) ||
|
||||||
isScreenId(id) ||
|
isScreenId(id) ||
|
||||||
(shouldSubscribe && isSubscribed)
|
(shouldSubscribe && isSubscribed)
|
||||||
)
|
) {
|
||||||
return u;
|
return u;
|
||||||
|
}
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
setSubscribedTracks: {
|
setSubscribedTracks: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue