![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/gadevoir/app/fragment/ |
Upload File : |
import Fragment from "absol/src/AppPattern/Fragment"; import OOP from "absol/src/HTML5/OOP"; import {$, _} from "../dom/Core"; /*** * @extends Fragment * @constructor */ function ConversationFrg(props) { Fragment.call(this); this.name = 'NoName'; this.conversationId = null; this.dir = "INCOME"; /*** * @type {GDVClient|null} */ Object.assign(this, props); /*** * * @type {GPhone|null} */ this.phone = null; this.ev_hangup = this.ev_hangup.bind(this); } OOP.mixClass(ConversationFrg, Fragment); ConversationFrg.prototype.createView = function () { this.$view = _({ class: ['gdv-fragment', 'gdv-outgoing-frag'], child: [ { class: 'gdv-income-frag-info', child: [ { class: 'gdv-income-frag-name', child: { text: this.name } }, { class: 'gdv-income-frag-type', child: { text: this.dir.toLowerCase() + ' voice chat' } }, { class: 'gdv-income-frag-status', child: { text: 'CONNECTING' } } ] }, { class: 'gdv-outgoing-frag-button-ctn', child: [ { tag: 'button', class: ['gdv-income-frag-action-btn', 'gdv-outgoing-frag-cancel-btn'], child: 'span.mdi.mdi-phone-hangup' } ] }, { tag: 'audio', class: 'gdv-conversation-frag-audio' } ] }); this.$cancelBtn = $('.gdv-outgoing-frag-cancel-btn', this.$view) .on('click', this.cancel.bind(this)); this.$status = $('.gdv-income-frag-status', this.$view); this.$audio = $('.gdv-conversation-frag-audio', this.$view); }; ConversationFrg.prototype.onStart = function () { this.phone = this.getContext("PHONE"); this.phone.on('hangup', this.ev_hangup); this._remoteErrorTimeout = setTimeout(function (){ this.pause(); this.$status.firstChild.data = "CANCELED"; setTimeout(this.stop.bind(this),3000); }.bind(this), 6000); this.remoteAudioSync = this.phone.conversation.getRemoteStreams().then(function (streams){ if (this.state!== 'RUNNING') return; this.$audio.srcObject = streams[0]; this.$audio.play(); this.$status.firstChild.data = "TRANSMIT"; clearTimeout(this._remoteErrorTimeout); }.bind(this)); }; ConversationFrg.prototype.ev_hangup = function (){ this.$audio.pause(); this.$cancelBtn.disabled = true; this.$status.firstChild.data = "HANGUP"; setTimeout(this.stop.bind(this),1000); } ConversationFrg.prototype.cancel = function () { this.$audio.pause(); this.phone.hangup(); this.$cancelBtn.disabled = true; this.$status.firstChild.data = "HANGUP"; setTimeout(this.stop.bind(this),1000); }; ConversationFrg.prototype.onStop = function (){ this.phone.off('hangup', this.ev_hangup); } export default ConversationFrg;