Skip to content

Conversation

HoonBaek
Copy link
Contributor

@HoonBaek HoonBaek commented Mar 1, 2023

For Internal Contributors

UIKIT-3263

Description Of Changes

  • Use dux pattern for voice player data structure
  • Add IDLE status to the VoicePlayerStatus
  • Use document&element to refer the Audio element in the unmount scope of useEffect in useVoicePlayer

Types Of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply_

  • Bugfix
  • New feature
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance (ex) Prettier)
  • Build configuration
  • Improvement (refactor code)

@HoonBaek HoonBaek self-assigned this Mar 1, 2023
@HoonBaek HoonBaek changed the base branch from main to develop/Voice-message March 1, 2023 09:45
@HoonBaek HoonBaek requested a review from sravan-s March 1, 2023 12:04
@HoonBaek HoonBaek requested a review from sravan-s March 1, 2023 23:18
@HoonBaek HoonBaek changed the title Fix/UI kit 3263/use reducer for voice player context operation refactor: Voice Player date structure Mar 2, 2023
@HoonBaek HoonBaek requested a review from sravan-s March 2, 2023 02:02
@HoonBaek HoonBaek merged commit 0003ab1 into develop/Voice-message Mar 2, 2023
@HoonBaek HoonBaek deleted the fix/UIKIT-3263/Use-reducer-for-voice-player-context-operation branch March 2, 2023 02:45
}).then((audioFile: File) => {
const currentAudioUnit = audioStorage[groupKey] || AudioUnitDefaultValue() as AudioStorageUnit;
const audioPlayer = new Audio(URL?.createObjectURL?.(audioFile));
audioPlayer.id = VOICE_PLAYER_AUDIO_ID;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set id of Audio element

Comment on lines +146 to +147
const voicePlayerRoot = document.getElementById(VOICE_PLAYER_ROOT_ID);
voicePlayerRoot.appendChild(audioPlayer);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And append the Audio element to the root element

removeEventHandler,
voicePlayerStore,
}}>
<div id={VOICE_PLAYER_ROOT_ID} style={{ display: 'none' }} />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the root element

Comment on lines +58 to +59
const voiceAudioPlayerElement = document.getElementById(VOICE_PLAYER_AUDIO_ID);
(voiceAudioPlayerElement as HTMLAudioElement)?.pause?.();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And get and use the Audio element to call pause here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants