react-native-audio-session
Advanced tools
Comparing version 0.0.1 to 0.0.2
21
index.js
@@ -37,2 +37,8 @@ import {NativeModules, Platform} from 'react-native' | ||
const create = () => { | ||
const noAndroid = () => { | ||
return new Promise((resolve, reject) => { | ||
resolve('AudioSession is not supported on Android.') | ||
}) | ||
} | ||
const currentCategory = () => { | ||
@@ -45,2 +51,4 @@ if (IS_IOS) { | ||
}) | ||
} else { | ||
return noAndroid() | ||
} | ||
@@ -54,6 +62,8 @@ } | ||
const keys = Object.keys(AudioOptions) | ||
const key = keys.length > event - 1 ? keys[event - 1]: null | ||
const key = keys.length > event - 1 ? keys[event - 1] : null | ||
resolve(AudioOptions[key]) | ||
}) | ||
}) | ||
} else { | ||
return noAndroid() | ||
} | ||
@@ -69,2 +79,4 @@ } | ||
}) | ||
} else { | ||
return noAndroid() | ||
} | ||
@@ -76,2 +88,4 @@ } | ||
return RNAudioSession.setCategory(category, options) | ||
} else { | ||
return noAndroid() | ||
} | ||
@@ -83,7 +97,12 @@ } | ||
return RNAudioSession.setMode(mode) | ||
} else { | ||
return noAndroid() | ||
} | ||
} | ||
const setCategoryAndMode = (category, mode, options) => { | ||
if (IS_IOS) { | ||
return RNAudioSession.setCategoryAndMode(category, mode, options) | ||
} else { | ||
return noAndroid() | ||
} | ||
@@ -90,0 +109,0 @@ } |
{ | ||
"name": "react-native-audio-session", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "React Native module for handling the AVAudioSession instance on iOS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
24858
2185
102