-
-
Notifications
You must be signed in to change notification settings - Fork 794
WIP: Audio video capability #2956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
PawBud
wants to merge
28
commits into
master
Choose a base branch
from
audio-video-capibility
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5e5fadc
jingle: added the initial boilerplate code for the plugin.
PawBud 387e781
(TBR)CallButton: added an unfunctional call button to the toolbar
PawBud 13b1ef9
(TBR)index: added buttons hook to jingle plugin
PawBud 6d88243
test
PawBud fb84f10
revert back code to avoid merge conflicts
PawBud d31b485
(TBR)added a boilerplate modal for jingle call
PawBud 5c4b40d
added the call button at the chat header.
PawBud 3f975d2
(TBR)Jingle modal
PawBud 70a49d3
(TBR)added 2 new custom plugins for jingle
PawBud 309c29d
added a toggling button in the centre of the chat-header
PawBud 97b737d
jingle: added the tests for jingle & styled the header button
PawBud 4eb696e
additional tests for jingle
PawBud 1f6bd12
tests for chat header written
PawBud cbba9cb
(TBR) added the message initation tests
PawBud 0e19aee
(TBR)added the Incoming pending & outgoing pending states, xep 0353 t…
PawBud ee9da60
tests: added tests to message initiation
PawBud 6c0f422
(TBR)propose id is now shared with the retract stanza
PawBud 322af18
(TBR) corrected message initiation test
PawBud bbcded7
changed the describe function text
PawBud c978385
changed the describe function text
PawBud 1140ad8
(TBR) corrected some tests
PawBud bbb985e
(TBR) fixed the tests and added the On message hook
PawBud 1235d42
(TBR)added the message retraction feature
PawBud b3ace4d
chat history: this commit adds the chat history of the jingle call st…
PawBud 4c5b855
(TRB) Retraction improvements
PawBud 7ef19af
(TBR)added a hook for the retraction
PawBud bec6455
The Reciever's side retraction tests pass
PawBud 8f72210
chat history ui added and tests as well
PawBud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { CustomElement } from 'shared/components/element.js'; | ||
import { _converse, api, converse } from "@converse/headless/core"; | ||
import tpl_header_button from "./templates/header-button.js"; | ||
import { JINGLE_CALL_STATUS } from "./constants.js"; | ||
|
||
import './styles/jingle.scss'; | ||
const { Strophe, $msg } = converse.env; | ||
const u = converse.env.utils; | ||
|
||
export default class CallNotification extends CustomElement { | ||
|
||
static get properties() { | ||
return { | ||
'jid': { type: String }, | ||
} | ||
} | ||
|
||
initialize() { | ||
this.model = _converse.chatboxes.get(this.jid); | ||
this.listenTo(this.model, 'change:jingle_status', () => this.requestUpdate()); | ||
} | ||
|
||
render() { | ||
return tpl_header_button(this); | ||
} | ||
|
||
endCall() { | ||
const jingle_status = this.model.get('jingle_status'); | ||
if ( jingle_status === JINGLE_CALL_STATUS.OUTGOING_PENDING ) { | ||
this.model.save('jingle_status', JINGLE_CALL_STATUS.ENDED); | ||
const initiator_stanza = this.model.messages.findWhere({ 'media': 'audio' }); | ||
PawBud marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const propose_id = initiator_stanza.attributes.propose_id; | ||
const message_id = u.getUniqueId(); | ||
api.send( | ||
$msg({ | ||
'from': _converse.bare_jid, | ||
'to': this.jid, | ||
'type': 'chat', | ||
id: message_id | ||
}).c('retract', { 'xmlns': Strophe.NS.JINGLEMESSAGE, 'id': propose_id }) | ||
.c('reason', { 'xmlns': Strophe.NS.JINGLE }) | ||
.c('cancel', {}).up() | ||
.t('Retracted').up().up() | ||
.c('store', { 'xmlns': Strophe.NS.HINTS }) | ||
); | ||
const attrs = { | ||
'from': _converse.bare_jid, | ||
'to': this.jid, | ||
'type': 'chat', | ||
'retract_id': propose_id, | ||
'msg_id': message_id | ||
} | ||
this.model.messages.create(attrs); | ||
return; | ||
} | ||
if ( jingle_status === JINGLE_CALL_STATUS.ACTIVE) { | ||
this.model.save('jingle_status', JINGLE_CALL_STATUS.ENDED); | ||
const stanza = $msg({ | ||
'from': _converse.bare_jid, | ||
'to': this.jid, | ||
'type': 'chat' | ||
}).c('finish', {'xmlns': Strophe.NS.JINGLEMESSAGE, 'id': this.getAttribute('id')}) | ||
.c('reason', {'xmlns': Strophe.NS.JINGLE}) | ||
.c('success', {}).up() | ||
.t('Success').up().up() | ||
.c('store', {'xmlns': Strophe.NS.HINTS}) | ||
api.send(stanza); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
api.elements.define('converse-call-notification', CallNotification); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const JINGLE_CALL_STATUS = { | ||
INCOMING_PENDING: 0, | ||
OUTGOING_PENDING: 1, | ||
ACTIVE: 2, | ||
ENDED: 3 | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @description Converse.js plugin which adds XEP-0166 Jingle | ||
* @copyright 2022, the Converse.js contributors | ||
* @license Mozilla Public License (MPLv2) | ||
*/ | ||
|
||
import { _converse, converse, api } from '@converse/headless/core.js'; | ||
import 'plugins/modal/index.js'; | ||
import "./chat-header-notification.js"; | ||
import './toolbar-button.js'; | ||
import { JINGLE_CALL_STATUS } from './constants.js'; | ||
import { html } from "lit"; | ||
import { parseJingleMessage, handleRetraction } from './utils.js'; | ||
|
||
const { Strophe } = converse.env; | ||
|
||
Strophe.addNamespace('JINGLE', 'urn:xmpp:jingle:1'); | ||
Strophe.addNamespace('JINGLEMESSAGE', 'urn:xmpp:jingle-message:1'); | ||
Strophe.addNamespace('JINGLERTP', 'urn:xmpp:jingle:apps:rtp:1'); | ||
|
||
converse.plugins.add('converse-jingle', { | ||
/* Plugin dependencies are other plugins which might be | ||
* overridden or relied upon, and therefore need to be loaded before | ||
* this plugin. | ||
* | ||
* If the setting "strict_plugin_dependencies" is set to true, | ||
* an error will be raised if the plugin is not found. By default it's | ||
* false, which means these plugins are only loaded opportunistically. | ||
* | ||
* NB: These plugins need to have already been loaded via require.js. | ||
*/ | ||
dependencies: ['converse-chatview'], | ||
|
||
initialize: function () { | ||
/* The initialize function gets called as soon as the plugin is | ||
* loaded by converse.js's plugin machinery. | ||
*/ | ||
_converse.JINGLE_CALL_STATUS = JINGLE_CALL_STATUS; | ||
_converse.api.listen.on('getToolbarButtons', (toolbar_el, buttons) => { | ||
if (!this.is_groupchat) { | ||
buttons.push(html` | ||
<converse-jingle-toolbar-button jid=${toolbar_el.model.get('jid')}> | ||
</converse-jingle-toolbar-button> | ||
`); | ||
} | ||
|
||
return buttons; | ||
}); | ||
api.listen.on('parseMessage', parseJingleMessage); | ||
api.listen.on('onMessage', handleRetraction); | ||
}, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import BootstrapModal from "plugins/modal/base.js"; | ||
import tpl_incoming_call from "../templates/incoming-call.js"; | ||
|
||
export default BootstrapModal.extend({ | ||
id: "start-jingle-call-modal", | ||
persistent: true, | ||
|
||
initialize () { | ||
this.items = []; | ||
this.loading_items = false; | ||
|
||
BootstrapModal.prototype.initialize.apply(this, arguments); | ||
}, | ||
|
||
toHTML () { | ||
return tpl_incoming_call(); | ||
} | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.conversejs { | ||
.chatbox { | ||
.chat-head { | ||
.jingle-call-initiated-button{ | ||
color: var(--chat-head-text-color) !important; | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { html } from 'lit'; | ||
import { __ } from 'i18n'; | ||
import { JINGLE_CALL_STATUS } from '../constants'; | ||
|
||
const tpl_active_call = (o) => { | ||
const button = __('End Call'); | ||
return html` | ||
<div> | ||
<a class="jingle-call-initiated-button" @click=${o.endCall}>${ button }</a> | ||
</div> | ||
`; | ||
} | ||
|
||
// ${(jingle_status === JINGLE_CALL_STATUS.ACTIVE) ? html`${tpl_active_call(el)}` : html`` } | ||
export default (el) => { | ||
const jingle_status = el.model.get('jingle_status'); | ||
return html` | ||
<div> | ||
${(jingle_status === JINGLE_CALL_STATUS.OUTGOING_PENDING) ? html`Calling...` : '' } | ||
</div> | ||
<div> | ||
${(jingle_status === JINGLE_CALL_STATUS.OUTGOING_PENDING) ? tpl_active_call(el) : '' } | ||
${(jingle_status === JINGLE_CALL_STATUS.ENDED) ? html`Call Ended` : '' } | ||
</div> | ||
`; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { html } from 'lit'; | ||
import { __ } from 'i18n'; | ||
|
||
const modal_close_button = html`<button type="button" class="btn btn-secondary" data-dismiss="modal">${__('Close')}</button>`; | ||
|
||
export default () => { | ||
const i18n_modal_title = __('Jingle Call'); | ||
return html` | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="muc-list-modal-label">${i18n_modal_title}</h5> | ||
</div> | ||
<div class="modal-body d-flex flex-column"> | ||
<span class="modal-alert"></span> | ||
<ul class="available-chatrooms list-group"> | ||
</ul> | ||
</div> | ||
<div class="container text-center cl-2"> | ||
<button type="button" class="btn btn-success">Audio Call</button> | ||
<button type="button" class="btn btn-primary">Video Call</button> | ||
</div> | ||
<div class="modal-footer">${modal_close_button}</div> | ||
</div> | ||
</div> | ||
`; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { html } from 'lit'; | ||
import { __ } from "i18n"; | ||
import { JINGLE_CALL_STATUS } from '../constants'; | ||
|
||
export default (el) => { | ||
const call_color = '--chat-toolbar-btn-color'; | ||
const end_call_color = '--chat-toolbar-btn-close-color'; | ||
const jingle_status = el.model.get('jingle_status'); | ||
let button_color, i18n_start_call; | ||
if (jingle_status === JINGLE_CALL_STATUS.OUTGOING_PENDING || jingle_status === JINGLE_CALL_STATUS.ACTIVE) { | ||
button_color = end_call_color; | ||
i18n_start_call = __('Stop the call'); | ||
} | ||
else { | ||
button_color = call_color; | ||
i18n_start_call = __('Start a call'); | ||
} | ||
return html` | ||
<button class="toggle-call" @click=${el.toggleJingleCallStatus} title="${i18n_start_call}"> | ||
<converse-icon id="temp" color="var(${ button_color })" class="fa fa-phone" size="1em"></converse-icon> | ||
</button>` | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.