Improved access to raw audio resources
This commit is contained in:
@@ -827,15 +827,15 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val name = "callwaiting_$toneCountry"
|
val name = "callwaiting_$toneCountry"
|
||||||
val resourceId = applicationContext.resources.getIdentifier(
|
val resourceId = resources.getIdentifier(
|
||||||
name,
|
name,
|
||||||
"raw",
|
"raw",
|
||||||
applicationContext.packageName
|
packageName
|
||||||
)
|
)
|
||||||
if (resourceId != 0) {
|
if (resourceId != 0) {
|
||||||
playUnInterrupted(resourceId, 1)
|
playUnInterrupted(resourceId, 1)
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Callwaiting tone $name.wav not found\")")
|
Log.e(TAG, "Callwaiting tone $name.wav not found")
|
||||||
}
|
}
|
||||||
if (ua.account.callHistory) {
|
if (ua.account.callHistory) {
|
||||||
CallHistoryNew(aor, peerUri, "in").add()
|
CallHistoryNew(aor, peerUri, "in").add()
|
||||||
@@ -1791,10 +1791,10 @@ class BaresipService: Service() {
|
|||||||
private fun playRingBack() {
|
private fun playRingBack() {
|
||||||
if (mediaPlayer == null) {
|
if (mediaPlayer == null) {
|
||||||
val name = "ringback_$toneCountry"
|
val name = "ringback_$toneCountry"
|
||||||
val resourceId = applicationContext.resources.getIdentifier(
|
val resourceId = resources.getIdentifier(
|
||||||
name,
|
name,
|
||||||
"raw",
|
"raw",
|
||||||
applicationContext.packageName)
|
packageName)
|
||||||
if (resourceId != 0) {
|
if (resourceId != 0) {
|
||||||
mediaPlayer = MediaPlayer.create(this, resourceId)
|
mediaPlayer = MediaPlayer.create(this, resourceId)
|
||||||
mediaPlayer?.isLooping = true
|
mediaPlayer?.isLooping = true
|
||||||
@@ -1809,10 +1809,10 @@ class BaresipService: Service() {
|
|||||||
private fun playBusy() {
|
private fun playBusy() {
|
||||||
if (mediaPlayer == null ) {
|
if (mediaPlayer == null ) {
|
||||||
val name = "busy_$toneCountry"
|
val name = "busy_$toneCountry"
|
||||||
val resourceId = applicationContext.resources.getIdentifier(
|
val resourceId = resources.getIdentifier(
|
||||||
name,
|
name,
|
||||||
"raw",
|
"raw",
|
||||||
applicationContext.packageName)
|
packageName)
|
||||||
if (resourceId != 0) {
|
if (resourceId != 0) {
|
||||||
mediaPlayer = MediaPlayer.create(this, resourceId)
|
mediaPlayer = MediaPlayer.create(this, resourceId)
|
||||||
mediaPlayer?.setOnCompletionListener {
|
mediaPlayer?.setOnCompletionListener {
|
||||||
|
|||||||
Reference in New Issue
Block a user