Skip to content
This repository was archived by the owner on Feb 10, 2022. It is now read-only.

Commit f54b715

Browse files
authored
Merge pull request #18 from sendbird/feature/calls-1590
[CALLS-1590] Update Quickstart Readme with Sound Effect Documentation
2 parents f5f76f7 + 4c2d892 commit f54b715

File tree

9 files changed

+36
-7
lines changed

9 files changed

+36
-7
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ $ npm run start
9090

9191
<br />
9292

93+
##Sound Effects
94+
You can use different sound effects to enhance the user experience for events that take place while using Sendbird Calls.
95+
96+
To add sound effects, use the `SendBirdCall.addDirectCallSound(type: SoundType, uri: string)` method for the following events: dialing, ringing, reconnecting, and reconnected. Remember to set sound effects before the mentioned events occur. To remove sound effects, use the `SendBirdCall.Options.removeDirectCallSound(type: SoundType)` method.
97+
98+
Use `SendBirdCall.addDirectCallSound(type: SoundType, uri: string)` method to set sound effects for a number of types: dialing, ringing, reconnecting, reconnected. Sound effects must be set before the events occur. To unregister a sound effect, remove it by calling `SendBirdCall.Options.removeDirectCallSound(type: SoundType)`.
99+
100+
```javascript
101+
// Play on a caller’s side when making a call.
102+
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.DIALING, DIALING_SOUND_URL);
103+
// Play on a callee’s side when receiving a call.
104+
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.RINGING, RINGING_SOUND_URL);
105+
// Play when a connection is lost, but the SDK immediately attempts to reconnect.
106+
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.RECONNECTING, RECONNECTING_SOUND_URL);
107+
// Play when the connection is re-established.
108+
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.RECONNECTED, RECONNECTED_SOUND_URL);
109+
```
110+
For more information about sound effects, see the [SDK for JavaScript README for Sound effects](https://github.com/sendbird/sendbird-calls-javascript#sound-effect)
111+
112+
93113
## Reference
94114

95115
For further detail on Sendbird Calls for JavaScript, refer to [Sendbird Calls SDK for JavaScript README](https://github.com/sendbird/sendbird-calls-javascript/blob/master/README.md).

lib/assets/Dialing.mp3

176 KB
Binary file not shown.

lib/assets/Reconnected.mp3

93 KB
Binary file not shown.

lib/assets/Reconnecting.mp3

99.1 KB
Binary file not shown.

lib/assets/Ringing.mp3

245 KB
Binary file not shown.

lib/views/LoginView.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import SendBirdCall from "sendbird-calls";
1+
import SendBirdCall, { SoundType } from "sendbird-calls";
22

33
import BaseElement from "../components/BaseElement";
44
import { createButton, createDiv, createInput, createLabel } from "../utils/domUtil";
55
import { classes } from "../css/styles.js";
66
import pack from "../../package.json";
7+
import DialingSound from "../assets/Dialing.mp3";
8+
import RingingSound from "../assets/Ringing.mp3";
9+
import ReconnectingSound from '../assets/Reconnecting.mp3';
10+
import ReconnectedSound from '../assets/Reconnected.mp3';
711

812
export default class LoginView extends BaseElement {
913
constructor({ args }) {
@@ -57,6 +61,11 @@ export default class LoginView extends BaseElement {
5761
const accessToken = inputAccessToken.value;
5862
if (appId) this.setAppId(appId);
5963
this.setCredentials(userId, accessToken);
64+
65+
SendBirdCall.addDirectCallSound(SoundType.DIALING, DialingSound)
66+
SendBirdCall.addDirectCallSound(SoundType.RINGING, RingingSound)
67+
SendBirdCall.addDirectCallSound(SoundType.RECONNECTING, ReconnectingSound)
68+
SendBirdCall.addDirectCallSound(SoundType.RECONNECTED, ReconnectedSound)
6069
};
6170

6271
if (!this.args.appId) {

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"express": "^4.17.1",
3535
"jss": "^10.0.3",
3636
"jss-preset-default": "^10.0.3",
37-
"sendbird-calls": "^1.2.5",
37+
"sendbird-calls": "^1.3.0",
3838
"uuid": "^3.3.3"
3939
}
4040
}

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = env => ({
5656
]
5757
},
5858
{
59-
test: /\.(png|jpe?g|gif|svg)$/i,
59+
test: /\.(png|jpe?g|gif|svg|mp3)$/i,
6060
use: [
6161
{
6262
loader: 'file-loader',

0 commit comments

Comments
 (0)