-
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathAudioContent.tsx
More file actions
38 lines (35 loc) · 1.19 KB
/
AudioContent.tsx
File metadata and controls
38 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { useAudioTagContext } from 'react-native-audio-api/development/react';
import { ActivityIndicator, Button, Text, View } from 'react-native';
import VolumeSlider from './VolumeSlider';
import { Spacer } from '../../components';
const AudioContent: React.FC = () => {
const { isReady, play, pause, playbackState, setMuted, muted } = useAudioTagContext();
return (
<View>
{!isReady ? (
<ActivityIndicator color="#fff" />
) : (
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ color: '#fff' }}>{playbackState}</Text>
<Spacer.Vertical size={12} />
<Button
onPress={() => setMuted(!muted)}
title={muted ? 'Unmute' : 'Mute'}
/>
<Spacer.Vertical size={20} />
<Button onPress={() => {
if (playbackState === 'playing') {
pause();
} else {
play();
}
}} title={playbackState === 'playing' ? 'Pause' : 'Play'} />
<Spacer.Vertical size={12} />
<Spacer.Vertical size={50} />
<VolumeSlider />
</View>
)}
</View>
);
};
export default AudioContent;