react-native-audio-player-button 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +106 -0
- package/lib/commonjs/components/AudioIconComponent.js +45 -0
- package/lib/commonjs/components/AudioIconComponent.js.map +1 -0
- package/lib/commonjs/components/AudioPlayerButtonComponent.js +166 -0
- package/lib/commonjs/components/AudioPlayerButtonComponent.js.map +1 -0
- package/lib/commonjs/components/RippleAnimationComponent.js +78 -0
- package/lib/commonjs/components/RippleAnimationComponent.js.map +1 -0
- package/lib/commonjs/constants/color_constant.js +15 -0
- package/lib/commonjs/constants/color_constant.js.map +1 -0
- package/lib/commonjs/constants/component_constant.js +20 -0
- package/lib/commonjs/constants/component_constant.js.map +1 -0
- package/lib/commonjs/constants/icon_constant.js +20 -0
- package/lib/commonjs/constants/icon_constant.js.map +1 -0
- package/lib/commonjs/helpers/audio_icon_helper.js +28 -0
- package/lib/commonjs/helpers/audio_icon_helper.js.map +1 -0
- package/lib/commonjs/helpers/ripple_animation_helper.js +44 -0
- package/lib/commonjs/helpers/ripple_animation_helper.js.map +1 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/services/audio_player_service.js +81 -0
- package/lib/commonjs/services/audio_player_service.js.map +1 -0
- package/lib/commonjs/utils/responsive_util.js +14 -0
- package/lib/commonjs/utils/responsive_util.js.map +1 -0
- package/lib/module/components/AudioIconComponent.js +37 -0
- package/lib/module/components/AudioIconComponent.js.map +1 -0
- package/lib/module/components/AudioPlayerButtonComponent.js +158 -0
- package/lib/module/components/AudioPlayerButtonComponent.js.map +1 -0
- package/lib/module/components/RippleAnimationComponent.js +70 -0
- package/lib/module/components/RippleAnimationComponent.js.map +1 -0
- package/lib/module/constants/color_constant.js +8 -0
- package/lib/module/constants/color_constant.js.map +1 -0
- package/lib/module/constants/component_constant.js +8 -0
- package/lib/module/constants/component_constant.js.map +1 -0
- package/lib/module/constants/icon_constant.js +13 -0
- package/lib/module/constants/icon_constant.js.map +1 -0
- package/lib/module/helpers/audio_icon_helper.js +20 -0
- package/lib/module/helpers/audio_icon_helper.js.map +1 -0
- package/lib/module/helpers/ripple_animation_helper.js +37 -0
- package/lib/module/helpers/ripple_animation_helper.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/services/audio_player_service.js +74 -0
- package/lib/module/services/audio_player_service.js.map +1 -0
- package/lib/module/utils/responsive_util.js +7 -0
- package/lib/module/utils/responsive_util.js.map +1 -0
- package/lib/typescript/index.test.d.ts +1 -0
- package/lib/typescript/index.test.d.ts.map +1 -0
- package/package.json +161 -0
- package/src/components/AudioIconComponent.js +40 -0
- package/src/components/AudioPlayerButtonComponent.js +170 -0
- package/src/components/RippleAnimationComponent.js +61 -0
- package/src/constants/color_constant.js +8 -0
- package/src/constants/component_constant.js +8 -0
- package/src/constants/icon_constant.js +12 -0
- package/src/helpers/audio_icon_helper.js +25 -0
- package/src/helpers/ripple_animation_helper.js +46 -0
- package/src/index.js +2 -0
- package/src/services/audio_player_service.js +90 -0
- package/src/utils/responsive_util.js +8 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNativeSound = _interopRequireDefault(require("react-native-sound"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
// Notice: The audio file must have the Bit Rate Mode as Constant in order to prevent the library from
|
|
10
|
+
// returning invalid audio duration
|
|
11
|
+
|
|
12
|
+
const audioPlayerService = (() => {
|
|
13
|
+
return {
|
|
14
|
+
play,
|
|
15
|
+
playPause,
|
|
16
|
+
stop,
|
|
17
|
+
clearAllAudio
|
|
18
|
+
};
|
|
19
|
+
function play(filename, itemUuId, isFromAppBundle, playingUuId, callback) {
|
|
20
|
+
if (itemUuId == playingUuId) return; // prevent the player from playing the same audio muliple time overlap each other
|
|
21
|
+
|
|
22
|
+
const audioPlayer = isFromAppBundle ? new _reactNativeSound.default(filename, _reactNativeSound.default.MAIN_BUNDLE, error => _handlePlayCallback(error, audioPlayer, callback)) : new _reactNativeSound.default(filename, error => _handlePlayCallback(error, audioPlayer, callback));
|
|
23
|
+
}
|
|
24
|
+
function playPause(audioPlayer, countInterval, callback) {
|
|
25
|
+
if (!!countInterval) {
|
|
26
|
+
clearInterval(countInterval);
|
|
27
|
+
audioPlayer.pause();
|
|
28
|
+
audioPlayer.getCurrentTime(seconds => {
|
|
29
|
+
callback(audioPlayer, seconds, audioPlayer.getDuration(), null);
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
_playAudio(audioPlayer, callback, countInterval);
|
|
34
|
+
}
|
|
35
|
+
function stop(audioPlayer, countInterval) {
|
|
36
|
+
clearInterval(countInterval);
|
|
37
|
+
if (!audioPlayer) return;
|
|
38
|
+
audioPlayer.stop();
|
|
39
|
+
}
|
|
40
|
+
function clearAllAudio() {
|
|
41
|
+
if (!!global.audioPlayer || !!global.countInterval) {
|
|
42
|
+
global.audioPlayer.release();
|
|
43
|
+
clearInterval(global.countInterval);
|
|
44
|
+
global.audioPlayer = null;
|
|
45
|
+
global.countInterval = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// private method
|
|
50
|
+
function _countPlaySeconds(audioPlayer, callback) {
|
|
51
|
+
if (!audioPlayer) return null;
|
|
52
|
+
const countInterval = setInterval(() => {
|
|
53
|
+
audioPlayer.getCurrentTime(seconds => {
|
|
54
|
+
if (seconds == audioPlayer.getDuration()) return clearInterval(countInterval);
|
|
55
|
+
callback(audioPlayer, seconds, audioPlayer.getDuration(), countInterval);
|
|
56
|
+
});
|
|
57
|
+
}, 150); // Use 150 ms to make the slider move smoother
|
|
58
|
+
|
|
59
|
+
return countInterval;
|
|
60
|
+
}
|
|
61
|
+
function _playAudio(audioPlayer, callback) {
|
|
62
|
+
let countInterval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
63
|
+
// Clear the previous counting and start a new count when start playing the audio
|
|
64
|
+
clearInterval(countInterval);
|
|
65
|
+
const countPlaySeconds = _countPlaySeconds(audioPlayer, callback);
|
|
66
|
+
audioPlayer.play(success => {
|
|
67
|
+
if (success) {
|
|
68
|
+
clearInterval(countPlaySeconds);
|
|
69
|
+
audioPlayer.release();
|
|
70
|
+
callback(null, 0, 0, null); // reset the audioPlayer, playSeconds, duration and countInterval
|
|
71
|
+
} else console.log('playback failed due to audio decoding errors');
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function _handlePlayCallback(error, audioPlayer, callback) {
|
|
75
|
+
if (!!error) return console.log('failed to play audio = ', error);
|
|
76
|
+
_playAudio(audioPlayer, callback);
|
|
77
|
+
}
|
|
78
|
+
})();
|
|
79
|
+
var _default = audioPlayerService;
|
|
80
|
+
exports.default = _default;
|
|
81
|
+
//# sourceMappingURL=audio_player_service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["audioPlayerService","play","playPause","stop","clearAllAudio","filename","itemUuId","isFromAppBundle","playingUuId","callback","audioPlayer","Sound","MAIN_BUNDLE","error","_handlePlayCallback","countInterval","clearInterval","pause","getCurrentTime","seconds","getDuration","_playAudio","global","release","_countPlaySeconds","setInterval","countPlaySeconds","success","console","log"],"sourceRoot":"../../src","sources":["audio_player_service.js"],"mappings":";;;;;;AAAA;AAAuC;AAEvC;AACA;;AAEA,MAAMA,kBAAkB,GAAG,CAAC,MAAM;EAChC,OAAO;IACLC,IAAI;IACJC,SAAS;IACTC,IAAI;IACJC;EACF,CAAC;EAED,SAASH,IAAI,CAACI,QAAQ,EAAEC,QAAQ,EAAEC,eAAe,EAAEC,WAAW,EAAEC,QAAQ,EAAE;IACxE,IAAIH,QA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+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isLowPixelDensityDevice = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const XHDPIRatio = 2;
|
|
9
|
+
const isLowPixelDensityDevice = () => {
|
|
10
|
+
const devicePixelRatio = Math.round(_reactNative.PixelRatio.roundToNearestPixel(_reactNative.PixelRatio.get()));
|
|
11
|
+
return devicePixelRatio <= XHDPIRatio;
|
|
12
|
+
};
|
|
13
|
+
exports.isLowPixelDensityDevice = isLowPixelDensityDevice;
|
|
14
|
+
//# sourceMappingURL=responsive_util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["XHDPIRatio","isLowPixelDensityDevice","devicePixelRatio","Math","round","PixelRatio","roundToNearestPixel","get"],"sourceRoot":"../../src","sources":["responsive_util.js"],"mappings":";;;;;;AAAA;AAEA,MAAMA,UAAU,GAAG,CAAC;AAEb,MAAMC,uBAAuB,GAAG,MAAM;EAC3C,MAAMC,gBAAgB,GAAGC,IAAI,CAACC,KAAK,CAACC,uBAAU,CAACC,mBAAmB,CAACD,uBAAU,CAACE,GAAG,EAAE,CAAC,CAAC;EACrF,OAAOL,gBAAgB,IAAIF,UAAU;AACvC,CAAC;AAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import color from '../constants/color_constant';
|
|
3
|
+
import { defaultIconSize, primaryIconColor, secondaryIconColor } from '../constants/component_constant';
|
|
4
|
+
import audioIconHelper from '../helpers/audio_icon_helper';
|
|
5
|
+
const AudioIconComponent = props => {
|
|
6
|
+
const getIconColor = () => {
|
|
7
|
+
const primaryColor = props.iconPrimaryColor || primaryIconColor;
|
|
8
|
+
const secondaryColor = props.iconSecondaryColor || secondaryIconColor;
|
|
9
|
+
return props.isPlaying ? secondaryColor : primaryColor;
|
|
10
|
+
};
|
|
11
|
+
const iconSize = props.iconSize || defaultIconSize;
|
|
12
|
+
{/* CloneElement is used so we can pass different type of icon and still using the same configuration */}
|
|
13
|
+
return /*#__PURE__*/React.cloneElement(audioIconHelper.getIcon(props.customIcon, props.isSpeakerIcon), {
|
|
14
|
+
name: audioIconHelper.getIconName(props.customIconSet, props.isSpeakerIcon, props.audio, props.isPlaying),
|
|
15
|
+
size: iconSize,
|
|
16
|
+
color: !!props.audio ? getIconColor() : color.muted,
|
|
17
|
+
style: [props.iconStyle, {
|
|
18
|
+
width: iconSize,
|
|
19
|
+
marginLeft: props.isPlaying && !props.isSpeakerIcon ? -2 : 0
|
|
20
|
+
}]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export default AudioIconComponent;
|
|
24
|
+
{/*
|
|
25
|
+
<AudioIconComponent
|
|
26
|
+
isPlaying={boolean}
|
|
27
|
+
audio={audio's object}
|
|
28
|
+
isSpeakerIcon={boolean}
|
|
29
|
+
iconStyle={{}}
|
|
30
|
+
iconSize={number}
|
|
31
|
+
primaryColor={}
|
|
32
|
+
secondaryColor={}
|
|
33
|
+
customIcon={Icon component}
|
|
34
|
+
customIconSet={{play: '', pause: '', mute: ''}}
|
|
35
|
+
/>
|
|
36
|
+
*/}
|
|
37
|
+
//# sourceMappingURL=AudioIconComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","color","defaultIconSize","primaryIconColor","secondaryIconColor","audioIconHelper","AudioIconComponent","props","getIconColor","primaryColor","iconPrimaryColor","secondaryColor","iconSecondaryColor","isPlaying","iconSize","cloneElement","getIcon","customIcon","isSpeakerIcon","name","getIconName","customIconSet","audio","size","muted","style","iconStyle","width","marginLeft"],"sourceRoot":"../../src","sources":["AudioIconComponent.js"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,KAAK,MAAM,6BAA6B;AAC/C,SAAQC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,QAAO,iCAAiC;AACrG,OAAOC,eAAe,MAAM,8BAA8B;AAE1D,MAAMC,kBAAkB,GAAIC,KAAK,IAAK;EACpC,MAAMC,YAAY,GAAG,MAAM;IACzB,MAAMC,YAAY,GAAGF,KAAK,CAACG,gBAAgB,IAAIP,gBAAgB;IAC/D,MAAMQ,cAAc,GAAGJ,KAAK,CAACK,kBAAkB,IAAIR,kBAAkB;IACrE,OAAOG,KAAK,CAACM,SAAS,GAAGF,cAAc,GAAGF,YAAY;EACxD,CAAC;EAED,MAAMK,QAAQ,GAAGP,KAAK,CAACO,QAAQ,IAAIZ,eAAe;EAElD,CAAC;EACD,oBACEF,KAAK,CAACe,YAAY,CAACV,eAAe,CAACW,OAAO,CAACT,KAAK,CAACU,UAAU,EAAEV,KAAK,CAACW,aAAa,CAAC,EAAE;IACjFC,IAAI,EAAEd,eAAe,CAACe,WAAW,CAACb,KAAK,CAACc,aAAa,EAAEd,KAAK,CAACW,aAAa,EAAEX,KAAK,CAACe,KAAK,EAAEf,KAAK,CAACM,SAAS,CAAC;IACzGU,IAAI,EAAET,QAAQ;IAAEb,KAAK,EAAE,CAAC,CAACM,KAAK,CAACe,KAAK,GAAGd,YAAY,EAAE,GAAGP,KAAK,CAACuB,KAAK;IACnEC,KAAK,EAAE,CAAClB,KAAK,CAACmB,SAAS,EAAE;MAAEC,KAAK,EAAEb,QAAQ;MAAEc,UAAU,EAAGrB,KAAK,CAACM,SAAS,IAAK,CAACN,KAAK,CAACW,aAAa,GAAI,CAAC,CAAC,GAAG;IAAE,CAAC;EAC/G,CAAC,CAAC;AAEN,CAAC;AAED,eAAeZ,kBAAkB;AAEjC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAZC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import AudioIconComponent from './AudioIconComponent';
|
|
4
|
+
import RippleAnimationComponent from './RippleAnimationComponent';
|
|
5
|
+
import { defaultBtnSize } from '../constants/component_constant';
|
|
6
|
+
import color from '../constants/color_constant';
|
|
7
|
+
import audioPlayerService from '../services/audio_player_service';
|
|
8
|
+
const AudioPlayerButtonComponent = props => {
|
|
9
|
+
const localAudioPlayer = useRef(null);
|
|
10
|
+
const [state, setState] = useState({
|
|
11
|
+
playSeconds: 0,
|
|
12
|
+
duration: 0,
|
|
13
|
+
countInterval: null
|
|
14
|
+
});
|
|
15
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
// Clear the local audio if the user is switching to play another audio
|
|
18
|
+
if (!!props.playingUuid && props.playingUuid != props.itemUuid) clearLocalAudioPlayer();
|
|
19
|
+
|
|
20
|
+
// Clear all the audio if the playingUuid is null (ex: exit the screen)
|
|
21
|
+
if (!props.playingUuid && !!global.audioPlayer && !!localAudioPlayer.current) {
|
|
22
|
+
clearLocalAudioPlayer();
|
|
23
|
+
audioPlayerService.clearAllAudio();
|
|
24
|
+
}
|
|
25
|
+
}, [props.playingUuid]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
return () => {
|
|
28
|
+
audioPlayerService.clearAllAudio();
|
|
29
|
+
}; // Clear all the audio when component is unmount
|
|
30
|
+
}, []);
|
|
31
|
+
const clearLocalAudioPlayer = () => {
|
|
32
|
+
localAudioPlayer.current = null;
|
|
33
|
+
setState({
|
|
34
|
+
playSeconds: 0,
|
|
35
|
+
duration: 0,
|
|
36
|
+
countInterval: null
|
|
37
|
+
});
|
|
38
|
+
setIsPlaying(false);
|
|
39
|
+
};
|
|
40
|
+
const updateState = (playSeconds, duration, countInterval) => {
|
|
41
|
+
setState({
|
|
42
|
+
playSeconds,
|
|
43
|
+
duration,
|
|
44
|
+
countInterval
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const handleLocalAudioPlayer = () => {
|
|
48
|
+
if (!props.allowPause) {
|
|
49
|
+
audioPlayerService.clearAllAudio();
|
|
50
|
+
clearLocalAudioPlayer();
|
|
51
|
+
props.updatePlayingUuid(null);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
audioPlayerService.playPause(localAudioPlayer.current, state.countInterval, (audioPlayer, playSeconds, duration, countInterval) => {
|
|
55
|
+
handleAudioCallback(audioPlayer, playSeconds, duration, countInterval);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const toggleAudio = () => {
|
|
59
|
+
if (!!localAudioPlayer.current) return handleLocalAudioPlayer();
|
|
60
|
+
audioPlayerService.clearAllAudio(); // Clear all the playing audio when starting to play a new audio if there is an existing audio is playing
|
|
61
|
+
audioPlayerService.play(props.audio, props.itemUuid, props.isFromAppBundle || false, props.playingUuid, (audioPlayer, playSeconds, duration, countInterval) => {
|
|
62
|
+
handleAudioCallback(audioPlayer, playSeconds, duration, countInterval);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const handleAudioCallback = (audioPlayer, playSeconds, duration, countInterval) => {
|
|
66
|
+
global.audioPlayer = audioPlayer;
|
|
67
|
+
global.countInterval = countInterval;
|
|
68
|
+
localAudioPlayer.current = audioPlayer;
|
|
69
|
+
updateState(playSeconds, duration, countInterval);
|
|
70
|
+
handleStopPlaying(countInterval, playSeconds, duration);
|
|
71
|
+
};
|
|
72
|
+
const handleStopPlaying = (countInterval, playSeconds, duration) => {
|
|
73
|
+
if (!countInterval) {
|
|
74
|
+
setIsPlaying(false);
|
|
75
|
+
if (playSeconds == 0 && duration == 0) props.updatePlayingUuid(null);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const onPress = () => {
|
|
79
|
+
props.updatePlayingUuid(props.itemUuid);
|
|
80
|
+
setIsPlaying(!isPlaying);
|
|
81
|
+
toggleAudio();
|
|
82
|
+
};
|
|
83
|
+
const renderRippleAnimation = () => {
|
|
84
|
+
return /*#__PURE__*/React.createElement(RippleAnimationComponent, {
|
|
85
|
+
rippleColor: props.rippleColor,
|
|
86
|
+
height: props.rippleHeight,
|
|
87
|
+
width: props.rippleWidth,
|
|
88
|
+
radius: props.rippleRadius,
|
|
89
|
+
isPlaying: isPlaying,
|
|
90
|
+
rippleStyle: props.rippleStyle
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const renderBtn = () => {
|
|
94
|
+
const btnStyles = {
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
backgroundColor: props.buttonColor || color.white,
|
|
97
|
+
borderRadius: 48,
|
|
98
|
+
elevation: props.hasShadow ? 4 : 0,
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
height: props.buttonHeight || defaultBtnSize,
|
|
101
|
+
width: props.buttonWidth || defaultBtnSize,
|
|
102
|
+
zIndex: 10
|
|
103
|
+
};
|
|
104
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
105
|
+
onPress: () => onPress(),
|
|
106
|
+
disabled: !props.audio,
|
|
107
|
+
style: [btnStyles, props.buttonStyle]
|
|
108
|
+
}, /*#__PURE__*/React.createElement(AudioIconComponent, {
|
|
109
|
+
isPlaying: isPlaying,
|
|
110
|
+
audio: props.audio,
|
|
111
|
+
isSpeakerIcon: props.isSpeakerIcon,
|
|
112
|
+
iconStyle: props.iconStyle,
|
|
113
|
+
iconSize: props.iconSize,
|
|
114
|
+
iconPrimaryColor: props.iconPrimaryColor,
|
|
115
|
+
iconSecondaryColor: props.iconSecondaryColor,
|
|
116
|
+
customIcon: props.customIcon,
|
|
117
|
+
customIconSet: props.customIconSet
|
|
118
|
+
}));
|
|
119
|
+
};
|
|
120
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
121
|
+
style: [{
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
alignItems: 'center'
|
|
124
|
+
}, props.containerStyle]
|
|
125
|
+
}, props.rippled && renderRippleAnimation(), renderBtn());
|
|
126
|
+
};
|
|
127
|
+
export default AudioPlayerButtonComponent;
|
|
128
|
+
|
|
129
|
+
// How to use
|
|
130
|
+
{/*
|
|
131
|
+
<AudioPlayerServcie
|
|
132
|
+
audio={}
|
|
133
|
+
itemUuid={string}
|
|
134
|
+
isFromAppBundle={boolean}
|
|
135
|
+
playingUuid={string}
|
|
136
|
+
isSpeakerIcon={boolean}
|
|
137
|
+
buttonColor={}
|
|
138
|
+
buttonHeight={number}
|
|
139
|
+
buttonWidth={number}
|
|
140
|
+
allowPause={boolean}
|
|
141
|
+
rippled={boolean}
|
|
142
|
+
rippleColor={}
|
|
143
|
+
rippleHeight={number}
|
|
144
|
+
rippleWidth={number}
|
|
145
|
+
rippleRadius={number}
|
|
146
|
+
rippleStyle={{}}
|
|
147
|
+
iconStyle={{}}
|
|
148
|
+
iconSize={number}
|
|
149
|
+
iconPrimaryColor={}
|
|
150
|
+
iconSecondaryColor={}
|
|
151
|
+
buttonStyle={{}}
|
|
152
|
+
updatePlayingUuid={(playingUuid) => {}}
|
|
153
|
+
containerStyle={{}}
|
|
154
|
+
customIcon={icon component}
|
|
155
|
+
customIconSet={{play: '', pause: '', mute: ''}}
|
|
156
|
+
/>
|
|
157
|
+
*/}
|
|
158
|
+
//# sourceMappingURL=AudioPlayerButtonComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","useRef","TouchableOpacity","View","AudioIconComponent","RippleAnimationComponent","defaultBtnSize","color","audioPlayerService","AudioPlayerButtonComponent","props","localAudioPlayer","state","setState","playSeconds","duration","countInterval","isPlaying","setIsPlaying","playingUuid","itemUuid","clearLocalAudioPlayer","global","audioPlayer","current","clearAllAudio","updateState","handleLocalAudioPlayer","allowPause","updatePlayingUuid","playPause","handleAudioCallback","toggleAudio","play","audio","isFromAppBundle","handleStopPlaying","onPress","renderRippleAnimation","rippleColor","rippleHeight","rippleWidth","rippleRadius","rippleStyle","renderBtn","btnStyles","alignItems","backgroundColor","buttonColor","white","borderRadius","elevation","hasShadow","justifyContent","height","buttonHeight","width","buttonWidth","zIndex","buttonStyle","isSpeakerIcon","iconStyle","iconSize","iconPrimaryColor","iconSecondaryColor","customIcon","customIconSet","containerStyle","rippled"],"sourceRoot":"../../src","sources":["AudioP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|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Animated, StyleSheet } from 'react-native';
|
|
3
|
+
import color from '../constants/color_constant';
|
|
4
|
+
import { defaultRippleSize } from '../constants/component_constant';
|
|
5
|
+
import rippleAnimationHelper from '../helpers/ripple_animation_helper';
|
|
6
|
+
const RippleAnimationComponent = props => {
|
|
7
|
+
const [componentDidMount, setComponentDidMount] = useState(false);
|
|
8
|
+
const [state] = useState({
|
|
9
|
+
opacity1: new Animated.Value(1),
|
|
10
|
+
opacity2: new Animated.Value(1),
|
|
11
|
+
opacity3: new Animated.Value(1),
|
|
12
|
+
scale1: new Animated.Value(0),
|
|
13
|
+
scale2: new Animated.Value(0),
|
|
14
|
+
scale3: new Animated.Value(0)
|
|
15
|
+
});
|
|
16
|
+
const animations = [{
|
|
17
|
+
scale: state.scale1,
|
|
18
|
+
opacity: state.opacity1
|
|
19
|
+
}, {
|
|
20
|
+
scale: state.scale2,
|
|
21
|
+
opacity: state.opacity2
|
|
22
|
+
}, {
|
|
23
|
+
scale: state.scale3,
|
|
24
|
+
opacity: state.opacity3
|
|
25
|
+
}];
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!componentDidMount) {
|
|
28
|
+
setComponentDidMount(true);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
props.isPlaying ? rippleAnimationHelper.start(animations) : rippleAnimationHelper.reset(animations);
|
|
32
|
+
}, [props.isPlaying]);
|
|
33
|
+
const rippleView = index => {
|
|
34
|
+
const rippleStyle = {
|
|
35
|
+
backgroundColor: props.rippleColor || color.black,
|
|
36
|
+
radius: props.radius || defaultRippleSize,
|
|
37
|
+
height: props.height || defaultRippleSize,
|
|
38
|
+
width: props.width || defaultRippleSize
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
41
|
+
key: index,
|
|
42
|
+
style: [StyleSheet.absoluteFillObject, {
|
|
43
|
+
backgroundColor: rippleStyle.backgroundColor
|
|
44
|
+
}, props.rippleStyle, {
|
|
45
|
+
opacity: animations[index].opacity,
|
|
46
|
+
transform: [{
|
|
47
|
+
scale: animations[index].scale
|
|
48
|
+
}],
|
|
49
|
+
height: rippleStyle.height,
|
|
50
|
+
width: rippleStyle.width,
|
|
51
|
+
borderRadius: rippleStyle.radius
|
|
52
|
+
}]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
return [...Array(3).keys()].map(index => rippleView(index));
|
|
56
|
+
};
|
|
57
|
+
export default RippleAnimationComponent;
|
|
58
|
+
|
|
59
|
+
// How to use
|
|
60
|
+
{/*
|
|
61
|
+
<Ripple
|
|
62
|
+
color={}
|
|
63
|
+
height={number}
|
|
64
|
+
width={number}
|
|
65
|
+
radius={number}
|
|
66
|
+
isPlaying={boolean}
|
|
67
|
+
rippleStyle={{}}
|
|
68
|
+
/>
|
|
69
|
+
*/}
|
|
70
|
+
//# sourceMappingURL=RippleAnimationComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","Animated","StyleSheet","color","defaultRippleSize","rippleAnimationHelper","RippleAnimationComponent","props","componentDidMount","setComponentDidMount","state","opacity1","Value","opacity2","opacity3","scale1","scale2","scale3","animations","scale","opacity","isPlaying","start","reset","rippleView","index","rippleStyle","backgroundColor","rippleColor","black","radius","height","width","absoluteFillObject","transform","borderRadius","Array","keys","map"],"sourceRoot":"../../src","sources":["RippleAnimationComponent.js"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,KAAK,MAAM,6BAA6B;AAC/C,SAAQC,iBAAiB,QAAO,iCAAiC;AACjE,OAAOC,qBAAqB,MAAM,oCAAoC;AAEtE,MAAMC,wBAAwB,GAAIC,KAAK,IAAK;EAC1C,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,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CAACuB,MAAM,IAAI1B,iBAAiB;MACzC2B,MAAM,EAAExB,KAAK,CAACwB,MAAM,IAAI3B,iBAAiB;MACzC4B,KAAK,EAAEzB,KAAK,CAACyB,KAAK,IAAI5B;IACxB,CAAC;IAED,oBAAO,oBAAC,QAAQ,CAAC,IAAI;MAAC,GAAG,EAAEqB,KAAM;MAAC,KAAK,EAAE,CAAEvB,UAAU,CAAC+B,kBAAkB,EAAE;QAAEN,eAAe,EAAED,WAAW,CAACC;MAAgB,CAAC,EAAEpB,KAAK,CAACmB,WAAW,EACnI;QAACN,OAAO,EAAEF,UAAU,CAACO,KAAK,CAAC,CAACL,OAAO;QAAEc,SAAS,EAAE,CAAC;UAAEf,KAAK,EAAED,UAAU,CAACO,KAAK,CAAC,CAACN;QAAM,CAAC,CAAC;QAAEY,MAAM,EAAEL,WAAW,CAACK,MAAM;QAAEC,KAAK,EAAEN,WAAW,CAACM,KAAK;QAAEG,YAAY,EAAET,WAAW,CAACI;MAAO,CAAC;IAC9K,EAAG;EACf,CAAC;EAED,OAAO,CAAC,GAAGM,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC,CAACC,GAAG,CAAEb,KAAK,IAAKD,UAAU,CAACC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,eAAenB,wBAAwB;;AAEvC;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GATC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["color","black","gray","muted","white"],"sourceRoot":"../../src","sources":["color_constant.js"],"mappings":"AAAA,MAAMA,KAAK,GAAG;EACZC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE;AACT,CAAC;AAED,eAAeJ,KAAK"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isLowPixelDensityDevice } from '../utils/responsive_util';
|
|
2
|
+
import color from './color_constant';
|
|
3
|
+
export const defaultBtnSize = isLowPixelDensityDevice() ? 48 : 56;
|
|
4
|
+
export const defaultRippleSize = isLowPixelDensityDevice() ? 48 : 56;
|
|
5
|
+
export const defaultIconSize = isLowPixelDensityDevice() ? 24 : 26;
|
|
6
|
+
export const primaryIconColor = color.black;
|
|
7
|
+
export const secondaryIconColor = color.gray;
|
|
8
|
+
//# sourceMappingURL=component_constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isLowPixelDensityDevice","color","defaultBtnSize","defaultRippleSize","defaultIconSize","primaryIconColor","black","secondaryIconColor","gray"],"sourceRoot":"../../src","sources":["component_constant.js"],"mappings":"AAAA,SAAQA,uBAAuB,QAAO,0BAA0B;AAChE,OAAOC,KAAK,MAAM,kBAAkB;AAEpC,OAAO,MAAMC,cAAc,GAAGF,uBAAuB,EAAE,GAAG,EAAE,GAAG,EAAE;AACjE,OAAO,MAAMG,iBAAiB,GAAGH,uBAAuB,EAAE,GAAG,EAAE,GAAG,EAAE;AACpE,OAAO,MAAMI,eAAe,GAAGJ,uBAAuB,EAAE,GAAG,EAAE,GAAG,EAAE;AAClE,OAAO,MAAMK,gBAAgB,GAAGJ,KAAK,CAACK,KAAK;AAC3C,OAAO,MAAMC,kBAAkB,GAAGN,KAAK,CAACO,IAAI"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const defaultAudioIconSet = {
|
|
2
|
+
'ion_icon': {
|
|
3
|
+
play: 'volume-high-outline',
|
|
4
|
+
pause: 'pause',
|
|
5
|
+
mute: 'volume-mute-outline'
|
|
6
|
+
},
|
|
7
|
+
'feather': {
|
|
8
|
+
play: 'play',
|
|
9
|
+
pause: 'pause',
|
|
10
|
+
mute: 'play'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=icon_constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultAudioIconSet","play","pause","mute"],"sourceRoot":"../../src","sources":["icon_constant.js"],"mappings":"AAAA,OAAO,MAAMA,mBAAmB,GAAG;EACjC,UAAU,EAAE;IACVC,IAAI,EAAE,qBAAqB;IAC3BC,KAAK,EAAE,OAAO;IACdC,IAAI,EAAE;EACR,CAAC;EACD,SAAS,EAAE;IACTF,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,OAAO;IACdC,IAAI,EAAE;EACR;AACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
3
|
+
import IonIcon from 'react-native-vector-icons/Ionicons';
|
|
4
|
+
import { defaultAudioIconSet } from '../constants/icon_constant';
|
|
5
|
+
const audioIconHelper = (() => {
|
|
6
|
+
return {
|
|
7
|
+
getIcon,
|
|
8
|
+
getIconName
|
|
9
|
+
};
|
|
10
|
+
function getIcon(customIcon, isSpeakerIcon) {
|
|
11
|
+
return customIcon ? customIcon : isSpeakerIcon ? /*#__PURE__*/React.createElement(IonIcon, null) : /*#__PURE__*/React.createElement(FeatherIcon, null);
|
|
12
|
+
}
|
|
13
|
+
function getIconName(customIconSet, isSpeakerIcon, audio, isPlaying) {
|
|
14
|
+
const icon = customIconSet ? customIconSet : isSpeakerIcon ? defaultAudioIconSet['ion_icon'] : defaultAudioIconSet['feather'];
|
|
15
|
+
if (!audio) return icon.mute;
|
|
16
|
+
return isPlaying ? icon.pause : icon.play;
|
|
17
|
+
}
|
|
18
|
+
})();
|
|
19
|
+
export default audioIconHelper;
|
|
20
|
+
//# sourceMappingURL=audio_icon_helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","FeatherIcon","IonIcon","defaultAudioIconSet","audioIconHelper","getIcon","getIconName","customIcon","isSpeakerIcon","customIconSet","audio","isPlaying","icon","mute","pause","play"],"sourceRoot":"../../src","sources":["audio_icon_helper.js"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,mCAAmC;AAC3D,OAAOC,OAAO,MAAM,oCAAoC;AACxD,SAAQC,mBAAmB,QAAO,4BAA4B;AAE9D,MAAMC,eAAe,GAAG,CAAC,MAAM;EAC7B,OAAO;IACLC,OAAO;IACPC;EACF,CAAC;EAED,SAASD,OAAO,CAACE,UAAU,EAAEC,aAAa,EAAE;IAC1C,OAAOD,UAAU,GAAGA,UAAU,GAAGC,aAAa,gBAAG,oBAAC,OAAO,OAAE,gBAAG,oBAAC,WAAW,OAAE;EAC9E;EAEA,SAASF,WAAW,CAACG,aAAa,EAAED,aAAa,EAAEE,KAAK,EAAEC,SAAS,EAAE;IACnE,MAAMC,IAAI,GAAGH,aAAa,GAAGA,aAAa,GAAGD,aAAa,GAAGL,mBAAmB,CAAC,UAAU,CAAC,GAAGA,mBAAmB,CAAC,SAAS,CAAC;IAC7H,IAAI,CAACO,KAAK,EACR,OAAOE,IAAI,CAACC,IAAI;IAElB,OAAOF,SAAS,GAAGC,IAAI,CAACE,KAAK,GAAGF,IAAI,CAACG,IAAI;EAC3C;AACF,CAAC,GAAG;AAEJ,eAAeX,eAAe"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
const rippleAnimationHelper = (() => {
|
|
3
|
+
return {
|
|
4
|
+
start,
|
|
5
|
+
reset
|
|
6
|
+
};
|
|
7
|
+
function start(animations) {
|
|
8
|
+
animations.map((animation, index) => {
|
|
9
|
+
Animated.loop(Animated.parallel([_animatedTiming(animation.scale, 1.8, index * 400), _animatedTiming(animation.opacity, 0, index * 400)], {
|
|
10
|
+
useNativeDriver: true
|
|
11
|
+
})).start();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function reset(animations) {
|
|
15
|
+
Animated.loop(Animated.parallel(_allAnimatedTimings(animations))).reset();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// private methods
|
|
19
|
+
function _animatedTiming(type, toValue, delay) {
|
|
20
|
+
return Animated.timing(type, {
|
|
21
|
+
toValue: toValue,
|
|
22
|
+
duration: 2000,
|
|
23
|
+
delay: delay,
|
|
24
|
+
useNativeDriver: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function _allAnimatedTimings(animations) {
|
|
28
|
+
const animated = [];
|
|
29
|
+
animations.map(animation => {
|
|
30
|
+
animated.push(Animated.timing(animation.scale));
|
|
31
|
+
animated.push(Animated.timing(animation.opacity));
|
|
32
|
+
});
|
|
33
|
+
return animated;
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
export default rippleAnimationHelper;
|
|
37
|
+
//# sourceMappingURL=ripple_animation_helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Animated","rippleAnimationHelper","start","reset","animations","map","animation","index","loop","parallel","_animatedTiming","scale","opacity","useNativeDriver","_allAnimatedTimings","type","toValue","delay","timing","duration","animated","push"],"sourceRoot":"../../src","sources":["ripple_animation_helper.js"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,MAAMC,qBAAqB,GAAG,CAAC,MAAM;EACnC,OAAO;IACLC,KAAK;IACLC;EACF,CAAC;EAED,SAASD,KAAK,CAACE,UAAU,EAAE;IACzBA,UAAU,CAACC,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;MACnCP,QAAQ,CAACQ,IAAI,CACXR,QAAQ,CAACS,QAAQ,CAAC,CAChBC,eAAe,CAACJ,SAAS,CAACK,KAAK,EAAE,GAAG,EAAEJ,KAAK,GAAG,GAAG,CAAC,EAClDG,eAAe,CAACJ,SAAS,CAACM,OAAO,EAAE,CAAC,EAAEL,KAAK,GAAG,GAAG,CAAC,CACnD,EAAE;QAAEM,eAAe,EAAE;MAAK,CAAC,CAAC,CAC9B,CAACX,KAAK,EAAE;IACX,CAAC,CAAC;EACJ;EAEA,SAASC,KAAK,CAACC,UAAU,EAAE;IACzBJ,QAAQ,CAACQ,IAAI,CACXR,QAAQ,CAACS,QAAQ,CAACK,mBAAmB,CAACV,UAAU,CAAC,CAAC,CACnD,CAACD,KAAK,EAAE;EACX;;EAEA;EACA,SAASO,eAAe,CAACK,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAE;IAC7C,OAAOjB,QAAQ,CAACkB,MAAM,CAACH,IAAI,EAAE;MACrBC,OAAO,EAAEA,OAAO;MAChBG,QAAQ,EAAE,IAAI;MACdF,KAAK,EAAEA,KAAK;MACZJ,eAAe,EAAE;IACnB,CAAC,CAAC;EACV;EAEA,SAASC,mBAAmB,CAACV,UAAU,EAAE;IACvC,MAAMgB,QAAQ,GAAG,EAAE;IACnBhB,UAAU,CAACC,GAAG,CAACC,SAAS,IAAI;MAC1Bc,QAAQ,CAACC,IAAI,CAACrB,QAAQ,CAACkB,MAAM,CAACZ,SAAS,CAACK,KAAK,CAAC,CAAC;MAC/CS,QAAQ,CAACC,IAAI,CAACrB,QAAQ,CAACkB,MAAM,CAACZ,SAAS,CAACM,OAAO,CAAC,CAAC;IACnD,CAAC,CAAC;IACF,OAAOQ,QAAQ;EACjB;AACF,CAAC,GAAG;AAEJ,eAAenB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AudioPlayerButton"],"sourceRoot":"../../src","sources":["index.js"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,yCAAyC;AACvE,eAAeA,iBAAiB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Sound from 'react-native-sound';
|
|
2
|
+
|
|
3
|
+
// Notice: The audio file must have the Bit Rate Mode as Constant in order to prevent the library from
|
|
4
|
+
// returning invalid audio duration
|
|
5
|
+
|
|
6
|
+
const audioPlayerService = (() => {
|
|
7
|
+
return {
|
|
8
|
+
play,
|
|
9
|
+
playPause,
|
|
10
|
+
stop,
|
|
11
|
+
clearAllAudio
|
|
12
|
+
};
|
|
13
|
+
function play(filename, itemUuId, isFromAppBundle, playingUuId, callback) {
|
|
14
|
+
if (itemUuId == playingUuId) return; // prevent the player from playing the same audio muliple time overlap each other
|
|
15
|
+
|
|
16
|
+
const audioPlayer = isFromAppBundle ? new Sound(filename, Sound.MAIN_BUNDLE, error => _handlePlayCallback(error, audioPlayer, callback)) : new Sound(filename, error => _handlePlayCallback(error, audioPlayer, callback));
|
|
17
|
+
}
|
|
18
|
+
function playPause(audioPlayer, countInterval, callback) {
|
|
19
|
+
if (!!countInterval) {
|
|
20
|
+
clearInterval(countInterval);
|
|
21
|
+
audioPlayer.pause();
|
|
22
|
+
audioPlayer.getCurrentTime(seconds => {
|
|
23
|
+
callback(audioPlayer, seconds, audioPlayer.getDuration(), null);
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
_playAudio(audioPlayer, callback, countInterval);
|
|
28
|
+
}
|
|
29
|
+
function stop(audioPlayer, countInterval) {
|
|
30
|
+
clearInterval(countInterval);
|
|
31
|
+
if (!audioPlayer) return;
|
|
32
|
+
audioPlayer.stop();
|
|
33
|
+
}
|
|
34
|
+
function clearAllAudio() {
|
|
35
|
+
if (!!global.audioPlayer || !!global.countInterval) {
|
|
36
|
+
global.audioPlayer.release();
|
|
37
|
+
clearInterval(global.countInterval);
|
|
38
|
+
global.audioPlayer = null;
|
|
39
|
+
global.countInterval = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// private method
|
|
44
|
+
function _countPlaySeconds(audioPlayer, callback) {
|
|
45
|
+
if (!audioPlayer) return null;
|
|
46
|
+
const countInterval = setInterval(() => {
|
|
47
|
+
audioPlayer.getCurrentTime(seconds => {
|
|
48
|
+
if (seconds == audioPlayer.getDuration()) return clearInterval(countInterval);
|
|
49
|
+
callback(audioPlayer, seconds, audioPlayer.getDuration(), countInterval);
|
|
50
|
+
});
|
|
51
|
+
}, 150); // Use 150 ms to make the slider move smoother
|
|
52
|
+
|
|
53
|
+
return countInterval;
|
|
54
|
+
}
|
|
55
|
+
function _playAudio(audioPlayer, callback) {
|
|
56
|
+
let countInterval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
57
|
+
// Clear the previous counting and start a new count when start playing the audio
|
|
58
|
+
clearInterval(countInterval);
|
|
59
|
+
const countPlaySeconds = _countPlaySeconds(audioPlayer, callback);
|
|
60
|
+
audioPlayer.play(success => {
|
|
61
|
+
if (success) {
|
|
62
|
+
clearInterval(countPlaySeconds);
|
|
63
|
+
audioPlayer.release();
|
|
64
|
+
callback(null, 0, 0, null); // reset the audioPlayer, playSeconds, duration and countInterval
|
|
65
|
+
} else console.log('playback failed due to audio decoding errors');
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function _handlePlayCallback(error, audioPlayer, callback) {
|
|
69
|
+
if (!!error) return console.log('failed to play audio = ', error);
|
|
70
|
+
_playAudio(audioPlayer, callback);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
export default audioPlayerService;
|
|
74
|
+
//# sourceMappingURL=audio_player_service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Sound","audioPlayerService","play","playPause","stop","clearAllAudio","filename","itemUuId","isFromAppBundle","playingUuId","callback","audioPlayer","MAIN_BUNDLE","error","_handlePlayCallback","countInterval","clearInterval","pause","getCurrentTime","seconds","getDuration","_playAudio","global","release","_countPlaySeconds","setInterval","countPlaySeconds","success","console","log"],"sourceRoot":"../../src","sources":["audio_player_service.js"],"mappings":"AAAA,OAAOA,KAAK,MAAM,oBAAoB;;AAEtC;AACA;;AAEA,MAAMC,kBAAkB,GAAG,CAAC,MAAM;EAChC,OAAO;IACLC,IAAI;IACJC,SAAS;IACTC,IAAI;IACJC;EACF,CAAC;EAED,SAASH,IAAI,CAACI,QAAQ,EAAEC,QAAQ,EAAEC,eAAe,EAAEC,WAAW,EAAEC,QAAQ,EAAE;IACxE,IAAIH,QAAQ,IAAIE,WAAW,EAAE,OAAO,CAAI;;IAExC,MAAME,WAAW,GAAGH,eAAe,GAAG,IAAIR,KAAK,CAACM,QAAQ,EAAEN,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,IAAIA,OAAO,IAAIR,WAAW,CAACS,WAAW,EAAE,EACtC,OAAOJ,aAAa,CAACD,aAAa,CAAC;QAErCL,QAAQ,CAACC,WAAW,EAAEQ,OAAO,EAAER,WAAW,CAACS,WAAW,EAAE,EAAEL,aAAa,CAAC;MAC1E,CAAC,CAAC;IACJ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAE;;IAEV,OAAOA,aAAa;EACtB;EAEA,SAASM,UAAU,CAACV,WAAW,EAAED,QAAQ,EAAwB;IAAA,IAAtBK,aAAa,uEAAG,IAAI;IAC7D;IACAC,aAAa,CAACD,aAAa,CAAC;IAC5B,MAAMW,gBAAgB,GAAGF,iBAAiB,CAACb,WAAW,EAAED,QAAQ,CAAC;IACjEC,WAAW,CAACT,IAAI,CAAEyB,OAAO,IAAK;MAC5B,IAAIA,OAAO,EAAE;QACXX,aAAa,CAACU,gBAAgB,CAAC;QAC/Bf,WAAW,CAACY,OAAO,EAAE;QACrBb,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAK;MAClC,CAAC,MAECkB,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;IAC/D,CAAC,CAAC;EACJ;EAEA,SAASf,mBAAmB,CAACD,KAAK,EAAEF,WAAW,EAAED,QAAQ,EAAE;IACzD,IAAI,CAAC,CAACG,KAAK,EAAE,OAAOe,OAAO,CAACC,GAAG,CAAC,yBAAyB,EAAEhB,KAAK,CAAC;IAEjEQ,UAAU,CAACV,WAAW,EAAED,QAAQ,CAAC;EACnC;AACF,CAAC,GAAG;AAEJ,eAAeT,kBAAkB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PixelRatio } from 'react-native';
|
|
2
|
+
const XHDPIRatio = 2;
|
|
3
|
+
export const isLowPixelDensityDevice = () => {
|
|
4
|
+
const devicePixelRatio = Math.round(PixelRatio.roundToNearestPixel(PixelRatio.get()));
|
|
5
|
+
return devicePixelRatio <= XHDPIRatio;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=responsive_util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PixelRatio","XHDPIRatio","isLowPixelDensityDevice","devicePixelRatio","Math","round","roundToNearestPixel","get"],"sourceRoot":"../../src","sources":["responsive_util.js"],"mappings":"AAAA,SAAQA,UAAU,QAAQ,cAAc;AAExC,MAAMC,UAAU,GAAG,CAAC;AAEpB,OAAO,MAAMC,uBAAuB,GAAG,MAAM;EAC3C,MAAMC,gBAAgB,GAAGC,IAAI,CAACC,KAAK,CAACL,UAAU,CAACM,mBAAmB,CAACN,UAAU,CAACO,GAAG,EAAE,CAAC,CAAC;EACrF,OAAOJ,gBAAgB,IAAIF,UAAU;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.tsx"],"names":[],"mappings":""}
|