Skip to content

Commit

Permalink
Merge branch 'dev' into fix-background-blur
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed Mar 11, 2024
2 parents 2098134 + e99675c commit a6353a1
Show file tree
Hide file tree
Showing 28 changed files with 317 additions and 122 deletions.
2 changes: 1 addition & 1 deletion examples/prebuilt-react-integration/package.json

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

5 changes: 3 additions & 2 deletions packages/hls-player/package.json

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

3 changes: 2 additions & 1 deletion packages/hls-stats/package.json

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

4 changes: 3 additions & 1 deletion packages/hms-video-store/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
const config = {
transform: {
'.(ts|tsx)$': '../../node_modules/ts-jest/dist/index.js',
'.(js|jsx)$': '../../node_modules/babel-jest/build/index.js',
Expand All @@ -9,3 +9,5 @@ module.exports = {
setupFiles: ['jest-canvas-mock', 'jsdom-worker'],
testEnvironment: 'jsdom',
};

export default config;
3 changes: 2 additions & 1 deletion packages/hms-video-store/package.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export abstract class RunningTrackAnalytics {
}

createSample() {
if (this.tempStats.length === 0) {
return;
}

this.samples.push(this.collateSample());
this.tempStats.length = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ export class PublishStatsAnalytics extends BaseStatsAnalytics {
});
});

// delete track analytics if track is not present in store and no samples are present
this.trackAnalytics.forEach(trackAnalytic => {
if (!this.store.hasTrack(trackAnalytic.track) && !(trackAnalytic.samples.length > 0)) {
this.trackAnalytics.delete(trackAnalytic.track_id);
}
});

if (shouldCreateSample) {
this.trackAnalytics.forEach(trackAnalytic => {
trackAnalytic.createSample();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ export class SubscribeStatsAnalytics extends BaseStatsAnalytics {
}
});

// delete track analytics if track is not present in store and no samples are present
this.trackAnalytics.forEach(trackAnalytic => {
if (!this.store.hasTrack(trackAnalytic.track) && !(trackAnalytic.samples.length > 0)) {
this.trackAnalytics.delete(trackAnalytic.track_id);
}
});

if (shouldCreateSample) {
this.trackAnalytics.forEach(trackAnalytic => {
trackAnalytic.createSample();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class AudioSinkManager {
this.eventBus.audioTrackRemoved.subscribe(this.handleTrackRemove);
this.eventBus.audioTrackUpdate.subscribe(this.handleTrackUpdate);
this.eventBus.deviceChange.subscribe(this.handleAudioDeviceChange);
this.startPollingForDevices();
}

setListener(listener?: HMSUpdateListener) {
Expand Down Expand Up @@ -267,19 +266,6 @@ export class AudioSinkManager {
}
};

private startPollingForDevices = () => {
// device change supported, no polling needed
if ('ondevicechange' in navigator.mediaDevices) {
return;
}
this.timer = setInterval(() => {
(async () => {
await this.deviceManager.init(true, false);
await this.autoSelectAudioOutput();
})();
}, 5000);
};

/**
* Mweb is not able to play via call channel by default, this is to switch from media channel to call channel
*/
Expand Down Expand Up @@ -308,10 +294,6 @@ export class AudioSinkManager {
const localAudioTrack = this.store.getLocalPeer()?.audioTrack;
if (localAudioTrack && earpiece) {
const externalDeviceID = bluetoothDevice?.deviceId || wired?.deviceId || speakerPhone?.deviceId;
// already selected appropriate device
if (localAudioTrack.settings.deviceId === externalDeviceID) {
return;
}
await localAudioTrack.setSettings({ deviceId: earpiece?.deviceId });
await localAudioTrack.setSettings({
deviceId: externalDeviceID,
Expand Down
7 changes: 4 additions & 3 deletions packages/hms-virtual-background/package.json

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

3 changes: 2 additions & 1 deletion packages/react-icons/package.json

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

5 changes: 3 additions & 2 deletions packages/react-sdk/package.json

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

11 changes: 6 additions & 5 deletions packages/roomkit-react/package.json

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

28 changes: 27 additions & 1 deletion packages/roomkit-react/src/Prebuilt/common/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useMedia } from 'react-use';
import { HMSHLSPlayer } from '@100mslive/hls-player';
import { JoinForm_JoinBtnType } from '@100mslive/types-prebuilt/elements/join_form';
import {
parsedUserAgent,
Expand Down Expand Up @@ -121,3 +122,28 @@ export const useMobileHLSStream = () => {
const { screenType } = useRoomLayoutConferencingScreen();
return isMobile && screenType === 'hls_live_streaming';
};

export const useKeyboardHandler = (isPaused: boolean, hlsPlayer: HMSHLSPlayer) => {
const handleKeyEvent = useCallback(
async (event: KeyboardEvent) => {
switch (event.key) {
case ' ':
if (isPaused) {
await hlsPlayer?.play();
} else {
hlsPlayer?.pause();
}
break;
case 'ArrowRight':
hlsPlayer?.seekTo(hlsPlayer?.getVideoElement().currentTime + 10);
break;
case 'ArrowLeft':
hlsPlayer?.seekTo(hlsPlayer?.getVideoElement().currentTime - 10);
break;
}
},
[hlsPlayer, isPaused],
);

return handleKeyEvent;
};
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ export const PinnedMessage = () => {
<Flex
css={{
p: '$4',
color: '$on_surface_medium',
bg: isMobile ? 'rgba(0, 0, 0, 0.64)' : '$surface_default',
color: '$on_surface_high',
bg: isMobile && elements?.chat?.is_overlay ? 'rgba(0, 0, 0, 0.64)' : '$surface_brighter',
r: '$1',
gap: '$4',
mb: '$8',
mt: '$8',
flexGrow: 1,
border: '1px solid $border_bright',
}}
align="center"
justify="between"
Expand All @@ -98,7 +99,7 @@ export const PinnedMessage = () => {
>
<Text
variant="sm"
css={{ color: '$on_surface_medium' }}
css={{ color: '$on_surface_high' }}
{...swipeHandlers}
title={pinnedMessages[pinnedMessageIndex]?.text}
>
Expand Down
Loading

0 comments on commit a6353a1

Please sign in to comment.