Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Conversations
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Android-smartphones
Conversations
Commits
7f9d836f
Unverified
Commit
7f9d836f
authored
1 year ago
by
Daniel Gultsch
Browse files
Options
Downloads
Patches
Plain Diff
play connected sound from sound file
parent
d31b24d0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/eu/siacs/conversations/services/CallIntegration.java
+17
-3
17 additions, 3 deletions
...java/eu/siacs/conversations/services/CallIntegration.java
src/main/res/raw/connected.ogg
+0
-0
0 additions, 0 deletions
src/main/res/raw/connected.ogg
with
17 additions
and
3 deletions
src/main/java/eu/siacs/conversations/services/CallIntegration.java
+
17
−
3
View file @
7f9d836f
...
...
@@ -20,6 +20,7 @@ import com.google.common.collect.Iterables;
import
com.google.common.collect.Lists
;
import
eu.siacs.conversations.Config
;
import
eu.siacs.conversations.R
;
import
eu.siacs.conversations.ui.util.MainThreadExecutor
;
import
eu.siacs.conversations.xmpp.Jid
;
import
eu.siacs.conversations.xmpp.jingle.JingleConnectionManager
;
...
...
@@ -33,6 +34,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
public
class
CallIntegration
extends
Connection
{
private
static
final
int
DEFAULT_VOLUME
=
80
;
private
final
Context
context
;
private
final
AppRTCAudioManager
appRTCAudioManager
;
private
AudioDevice
initialAudioDevice
=
null
;
private
final
AtomicBoolean
initialAudioDeviceConfigured
=
new
AtomicBoolean
(
false
);
...
...
@@ -43,6 +48,7 @@ public class CallIntegration extends Connection {
private
Callback
callback
=
null
;
public
CallIntegration
(
final
Context
context
)
{
this
.
context
=
context
.
getApplicationContext
();
if
(
selfManaged
())
{
setConnectionProperties
(
Connection
.
PROPERTY_SELF_MANAGED
);
this
.
appRTCAudioManager
=
null
;
...
...
@@ -297,7 +303,9 @@ public class CallIntegration extends Connection {
@Override
public
void
onStateChanged
(
final
int
state
)
{
Log
.
d
(
Config
.
LOGTAG
,
"onStateChanged("
+
state
+
")"
);
if
(
state
==
STATE_DISCONNECTED
)
{
if
(
state
==
STATE_ACTIVE
)
{
playConnectedSound
();
}
else
if
(
state
==
STATE_DISCONNECTED
)
{
final
var
audioManager
=
this
.
appRTCAudioManager
;
if
(
audioManager
!=
null
)
{
audioManager
.
executeOnMain
(
audioManager:
:
stop
);
...
...
@@ -305,9 +313,15 @@ public class CallIntegration extends Connection {
}
}
private
void
playConnectedSound
()
{
final
var
mediaPlayer
=
MediaPlayer
.
create
(
context
,
R
.
raw
.
connected
);
mediaPlayer
.
setVolume
(
DEFAULT_VOLUME
/
100
f
,
DEFAULT_VOLUME
/
100
f
);
mediaPlayer
.
start
();
}
public
void
success
()
{
Log
.
d
(
Config
.
LOGTAG
,
"CallIntegration.success()"
);
final
var
toneGenerator
=
new
ToneGenerator
(
AudioManager
.
STREAM_MUSIC
,
100
);
final
var
toneGenerator
=
new
ToneGenerator
(
AudioManager
.
STREAM_MUSIC
,
DEFAULT_VOLUME
);
toneGenerator
.
startTone
(
ToneGenerator
.
TONE_CDMA_CALLDROP_LITE
,
375
);
this
.
destroyWithDelay
(
new
DisconnectCause
(
DisconnectCause
.
LOCAL
,
null
),
375
);
}
...
...
@@ -323,7 +337,7 @@ public class CallIntegration extends Connection {
public
void
error
()
{
Log
.
d
(
Config
.
LOGTAG
,
"CallIntegration.error()"
);
final
var
toneGenerator
=
new
ToneGenerator
(
AudioManager
.
STREAM_MUSIC
,
80
);
final
var
toneGenerator
=
new
ToneGenerator
(
AudioManager
.
STREAM_MUSIC
,
DEFAULT_VOLUME
);
toneGenerator
.
startTone
(
ToneGenerator
.
TONE_CDMA_CALLDROP_LITE
,
375
);
this
.
destroyWithDelay
(
new
DisconnectCause
(
DisconnectCause
.
ERROR
,
null
),
375
);
this
.
destroyWith
(
new
DisconnectCause
(
DisconnectCause
.
ERROR
,
null
));
...
...
This diff is collapsed.
Click to expand it.
src/main/res/raw/connected.ogg
0 → 100644
+
0
−
0
View file @
7f9d836f
File added
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment