pause audio when unmount a RoomView and unloadAll when focusing at RoomsListView
This commit is contained in:
parent
8cab77f94e
commit
e84a5b3b4b
|
@ -102,7 +102,7 @@ import {
|
|||
import { Services } from '../../lib/services';
|
||||
import { withActionSheet, IActionSheetProvider } from '../../containers/ActionSheet';
|
||||
import { goRoom, TGoRoomItem } from '../../lib/methods/helpers/goRoom';
|
||||
import handleAudioMedia from '../../lib/methods/handleAudioMedia';
|
||||
import audioPlayer from '../../lib/methods/audioPlayer';
|
||||
|
||||
type TStateAttrsUpdate = keyof IRoomViewState;
|
||||
|
||||
|
@ -429,7 +429,8 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
|||
const { editing, room } = this.state;
|
||||
const db = database.active;
|
||||
this.mounted = false;
|
||||
await handleAudioMedia.unloadAllAudios();
|
||||
// TODO: Refactor when audio becomes global
|
||||
await audioPlayer.pauseCurrentAudio();
|
||||
if (!editing && this.messagebox && this.messagebox.current) {
|
||||
const { text } = this.messagebox.current;
|
||||
let obj: TSubscriptionModel | TThreadModel | null = null;
|
||||
|
|
|
@ -60,6 +60,7 @@ import {
|
|||
} from '../../lib/methods/helpers';
|
||||
import { E2E_BANNER_TYPE, DisplayMode, SortBy, MAX_SIDEBAR_WIDTH, themes } from '../../lib/constants';
|
||||
import { Services } from '../../lib/services';
|
||||
import audioPlayer from '../../lib/methods/audioPlayer';
|
||||
|
||||
type TNavigation = CompositeNavigationProp<
|
||||
StackNavigationProp<ChatsStackParamList, 'RoomsListView'>,
|
||||
|
@ -228,6 +229,8 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
|
|||
this.shouldUpdate = false;
|
||||
}
|
||||
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackPress);
|
||||
// TODO: Refactor when audio becomes global
|
||||
audioPlayer.unloadAllAudios();
|
||||
});
|
||||
this.unsubscribeBlur = navigation.addListener('blur', () => {
|
||||
this.animated = false;
|
||||
|
|
Loading…
Reference in New Issue