react-native-incall-manager
Advanced tools
Comparing version 1.4.0 to 1.5.0
26
index.js
@@ -13,2 +13,7 @@ 'use strict'; | ||
this.caeraPermission = 'unknow'; | ||
this.audioUriMap = { | ||
ringtone: { _BUNDLE_: null, _DEFAULT_: null}, | ||
ringback: { _BUNDLE_: null, _DEFAULT_: null}, | ||
busytone: { _BUNDLE_: null, _DEFAULT_: null}, | ||
}; | ||
this.checkRecordPermission = this.checkRecordPermission.bind(this); | ||
@@ -132,4 +137,25 @@ this.requestRecordPermission = this.requestRecordPermission.bind(this); | ||
} | ||
async getAudioUri(audioType, fileType) { | ||
if (typeof this.audioUriMap[audioType] === "undefined") { | ||
return null; | ||
} | ||
if (this.audioUriMap[audioType][fileType]) { | ||
return this.audioUriMap[audioType][fileType]; | ||
} else { | ||
try { | ||
let result = await _InCallManager.getAudioUriJS(audioType, fileType); | ||
if (typeof result === 'string' && result.length > 0) { | ||
this.audioUriMap[audioType][fileType] = result; | ||
return result | ||
} else { | ||
return null; | ||
} | ||
} catch (err) { | ||
return null; | ||
} | ||
} | ||
} | ||
} | ||
export default new InCallManager(); |
{ | ||
"name": "react-native-incall-manager", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Handling media-routes/sensors/events during a audio/video chat on React Native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -252,2 +252,3 @@ # react-native-incall-manager | ||
| async requestRecordPermission() | :smile: | :smile: | request record permission to user. return Promise. see **about permission** section above | | ||
| async getAudioUriJS() | :smile: | :smile: | get audio Uri path. this would be useful when you want to pass Uri into another module. | | ||
@@ -254,0 +255,0 @@ **Events** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25539627
8118
274