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
| // bind primary callbacks | |
| function bindCallCallbacks(e){ | |
| logger.write(`[WebSDk] Set up listeners for ID: ${currentCall.id()}`); | |
| currentCall.on(VoxImplant.CallEvents.Connected,onCallConnected); | |
| currentCall.on(VoxImplant.CallEvents.Disconnected,onCallDisconnected); | |
| currentCall.on(VoxImplant.CallEvents.Failed,onCallFailed); | |
| callForm.style.display = 'none'; | |
| callDisconnect.style.display = 'block'; | |
| } |
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
| sdk.on(VoxImplant.Events.IncomingCall, function (e) { | |
| logger.write(`[WebSDk] New incoming call with ID: ${e.call.id()}`); | |
| // if call already exists – hangup | |
| if(currentCall){ | |
| logger.write('[WebSDk] You already have active call. Hangup.'); | |
| e.call.hangup(); | |
| }else{ | |
| currentCall = e.call; | |
| bindCallCallbacks(); | |
| currentCall.answer(); |
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
| // link to current active call | |
| let currentCall; | |
| // create new call | |
| callForm.addEventListener('submit', function (e) { | |
| e.preventDefault(); | |
| const formData = new FormData(e.target); | |
| currentCall = sdk.call({number: formData.get('number'), video: {sendVideo: true, receiveVideo: true}}); | |
| bindCallCallbacks(); | |
| }); |
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
| try { | |
| // logging in | |
| await sdk.login(formData.get('login'), formData.get('password')); | |
| logger.write('[WebSDk] Authorization completed'); | |
| // change form visibility | |
| loginForm.style.display = 'none'; | |
| callForm.style.display = 'block'; | |
| }catch (e) { | |
| logger.write('[WebSDk] Wrong login or password'); | |
| } |
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
| // we must check current SDK state to prevent an exception in case of repeated init and connect | |
| if(sdk.getClientState()!=='CONNECTED') { | |
| // init SDK | |
| await sdk.init({remoteVideoContainerId:'js__workbench'}); | |
| logger.write('[WebSDk] Initialization completed'); | |
| // connecting to the Voximplant Cloud; | |
| // "false" argument disables checking of UDP connection (for fastest connect) | |
| await sdk.connect(false); | |
| logger.write('[WebSDk] Connected'); | |
| } |
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
| // set EventListener for the form submission; | |
| // we can send form to server by pressing the Enter key or the "Connect&Login" button | |
| loginForm.addEventListener('submit', async function (e) { | |
| e.preventDefault(); | |
| const formData = new FormData(e.target); | |
| }); |
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
| const sdk = VoxImplant.getInstance(); |
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
| 'use strict'; | |
| // logger in the right column | |
| const logger = new cLogger(document.querySelector('.js__logarea')); | |
| const loginForm = document.querySelector('.js__login-form'); | |
| const callForm = document.querySelector('.js__call-form'); | |
| const callDisconnect = document.querySelector('.js__call-disconnect'); | |
| // disable calling form until login |
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
| <script type="text/javascript" src="//cdn.voximplant.com/edge/voximplant.js"></script> | |
| <script> | |
| const sdk = VoxImplant.getInstance(); | |
| sdk.init(VOXIMPLANT_API_OPTIONS) | |
| .then(()=>sdk.connect()) | |
| .then(()=>sdk.login('foo@bar.baz.voximplant.com', 'secretpass')) | |
| .then((result)=>{ | |
| sdk.setVideoSettings(VOXIMPLANT_VIDEO_SETTINGS); | |
| sdk.setVideoBandwidth(VOXIMPLANT_VIDEO_BANDWIDTH); | |
| console.log(result); |
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
| { | |
| "id": "anet_a6", | |
| "version": 2, | |
| "name": "Anet A6", | |
| "inherits": "fdmprinter", | |
| "metadata": { | |
| "visible": true, | |
| "author": "Maciej Swic", | |
| "manufacturer": "Anet", | |
| "category": "Anet", |