Skip to content

Commit

Permalink
Merge branch 'dev' into chore/TKT-2025
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed Dec 10, 2024
2 parents a243abd + cf530a0 commit 2891b6d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { HMSRemoteAudioTrack } from '../media/tracks';
import { HMSRemotePeer } from '../sdk/models/peer';
import { Store } from '../sdk/store';
import HMSLogger from '../utils/logger';
import { sleep } from '../utils/timer-utils';

/**
* Following are the errors thrown when autoplay is blocked in different browsers
Expand Down Expand Up @@ -138,15 +137,11 @@ export class AudioSinkManager {
);
this.eventBus.analytics.publish(AnalyticsEventFactory.audioPlaybackError(ex));
if (audioEl?.error?.code === MediaError.MEDIA_ERR_DECODE) {
// try to wait for main execution to complete first
this.removeAudioElement(audioEl, track);
await sleep(500);
await this.handleTrackAdd({ track, peer, callListener: false });
if (!this.state.autoplayFailed) {
this.eventBus.analytics.publish(
AnalyticsEventFactory.audioRecovered('Audio recovered after media decode error'),
);
}
await track.setVolume(0);
await track.setVolume(this.volume);
this.eventBus.analytics.publish(
AnalyticsEventFactory.audioRecovered('Audio recovered after media decode error'),
);
}
};
track.setAudioElement(audioEl);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// @ts-check
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { match } from 'ts-pattern';
import { selectLocalPeer, selectLocalPeerRoleName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
import {
HMSRoomState,
selectLocalPeer,
selectLocalPeerRoleName,
selectRoomState,
useHMSActions,
useHMSStore,
} from '@100mslive/react-sdk';
import { CheckCircleIcon, ChevronDownIcon, CrossCircleIcon } from '@100mslive/react-icons';
import { Box, Button, Flex, Text } from '../../../../';
import { checkCorrectAnswer } from '../../../common/utils';
Expand All @@ -27,7 +34,7 @@ export const QuestionCard = ({
}) => {
const actions = useHMSActions();
const localPeer = useHMSStore(selectLocalPeer);

const roomState = useHMSStore(selectRoomState);
const isLocalPeerCreator = localPeer?.id === startedBy;
const localPeerRoleName = useHMSStore(selectLocalPeerRoleName);
const roleCanViewResponse =
Expand Down Expand Up @@ -183,13 +190,19 @@ export const QuestionCard = ({
) : null}
</Box>
{isLive && (
<QuestionActions isValidVote={isValidVote} onVote={handleVote} response={localPeerChoice} isQuiz={isQuiz} />
<QuestionActions
disableVote={roomState !== HMSRoomState.Connected}
isValidVote={isValidVote}
onVote={handleVote}
response={localPeerChoice}
isQuiz={isQuiz}
/>
)}
</Box>
);
};

const QuestionActions = ({ isValidVote, response, isQuiz, onVote }) => {
const QuestionActions = ({ isValidVote, response, isQuiz, onVote, disableVote }) => {
return (
<Flex align="center" justify="end" css={{ gap: '$4', w: '100%' }}>
{response ? (
Expand All @@ -199,7 +212,7 @@ const QuestionActions = ({ isValidVote, response, isQuiz, onVote }) => {
{!isQuiz && !response.skipped ? 'Voted' : null}
</Text>
) : (
<Button css={{ p: '$xs $10', fontWeight: '$semiBold' }} disabled={!isValidVote} onClick={onVote}>
<Button css={{ p: '$xs $10', fontWeight: '$semiBold' }} disabled={!isValidVote || disableVote} onClick={onVote}>
{isQuiz ? 'Answer' : 'Vote'}
</Button>
)}
Expand Down

0 comments on commit 2891b6d

Please sign in to comment.