quickblox-react-ui-kit 0.5.0-beta.2 → 0.5.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Data/repository/UsersRepository.d.ts.map +1 -1
- package/dist/Presentation/Views/DialogList/useDialogListViewModel.d.ts.map +1 -1
- package/dist/Presentation/Views/PreviewDialog/PreviewDialog.d.ts.map +1 -1
- package/dist/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.d.ts.map +1 -1
- package/dist/hooks/useQuickBloxUIKit.d.ts +2 -4
- package/dist/hooks/useQuickBloxUIKit.d.ts.map +1 -1
- package/dist/index-ui.js +938 -168
- package/media-recorder-js.d.ts +133 -0
- package/package.json +2 -1
- package/src/CommonTypes/FunctionResult.ts +0 -1
- package/src/Data/repository/UsersRepository.ts +2 -2
- package/src/Presentation/Views/DialogInfo/DialogInfo.scss +0 -1
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +30 -28
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.scss +8 -0
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +3 -1
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +28 -26
- package/src/hooks/useQuickBloxUIKit.ts +128 -160
- package/storybook-static/docs-Introduction-mdx.c4bd2a79.iframe.bundle.js +1 -0
- package/storybook-static/docs-Styling-mdx.28c7c723.iframe.bundle.js +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.a64d2b1e.iframe.bundle.js → runtime~main.b33364cd.iframe.bundle.js} +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +1 -1
- package/tsconfig.buildlib.json +2 -1
- package/tsconfig.json +2 -1
- package/.env +0 -1
- package/storybook-static/docs-Introduction-mdx.5addfa61.iframe.bundle.js +0 -1
- package/storybook-static/docs-Styling-mdx.9f4235f1.iframe.bundle.js +0 -1
package/dist/index-ui.js
CHANGED
|
@@ -57268,6 +57268,31 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.message-caption__user{padding:0px 16p
|
|
|
57268
57268
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
57269
57269
|
|
|
57270
57270
|
|
|
57271
|
+
/***/ }),
|
|
57272
|
+
|
|
57273
|
+
/***/ 3614:
|
|
57274
|
+
/***/ ((module) => {
|
|
57275
|
+
|
|
57276
|
+
"use strict";
|
|
57277
|
+
|
|
57278
|
+
|
|
57279
|
+
module.exports = {
|
|
57280
|
+
'unsupport': 'QBMediaRecorder is not supported this environment.',
|
|
57281
|
+
'unsupportCustomAudioRecorder': 'qbAudioRecorderWorker.js wasn\'t found.',
|
|
57282
|
+
'unsupportAudioContext': 'AudioContext API is not supported this environment.',
|
|
57283
|
+
'unsupportMediaRecorderWithOptions': 'Got a warning when creating a MediaRecorder, trying to create MediaRecorder without options.',
|
|
57284
|
+
'requreArgument': '1 argument required, but only 0 present.',
|
|
57285
|
+
'callbackError': 'Founded an error in callback:',
|
|
57286
|
+
'actionFailed': 'QBMediaRecorder is not created or has an invalid state.',
|
|
57287
|
+
'no_recorded_chunks': 'Does not have any recording data.',
|
|
57288
|
+
'streamRequired': 'MediaStream is required.',
|
|
57289
|
+
'InvalidState': 'QBMediaRecorder is not in a state in which the proposed operation is allowed to be executed.',
|
|
57290
|
+
'OutOfMemory': 'The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.',
|
|
57291
|
+
'IllegalStreamModification': 'A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.',
|
|
57292
|
+
'OtherRecordingError': 'Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.',
|
|
57293
|
+
'GenericError': 'The UA cannot provide the codec or recording option that has been requested'
|
|
57294
|
+
};
|
|
57295
|
+
|
|
57271
57296
|
/***/ }),
|
|
57272
57297
|
|
|
57273
57298
|
/***/ 3628:
|
|
@@ -57427,6 +57452,758 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.message-item{display:flex;flex-direct
|
|
|
57427
57452
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
57428
57453
|
|
|
57429
57454
|
|
|
57455
|
+
/***/ }),
|
|
57456
|
+
|
|
57457
|
+
/***/ 4505:
|
|
57458
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
57459
|
+
|
|
57460
|
+
"use strict";
|
|
57461
|
+
|
|
57462
|
+
|
|
57463
|
+
var ERRORS = __webpack_require__(3614);
|
|
57464
|
+
|
|
57465
|
+
/**
|
|
57466
|
+
* @constructor QBMediaRecorder
|
|
57467
|
+
* @param {Object} [opts] - Object of parameters.
|
|
57468
|
+
* @param {String} opts[].mimeType=video - Specifies the media type and container format for the recording. You can set simply: 'video' or 'audio' or 'audio/webm' ('audio/wav' or 'audio/mp3' mimeTypes uses AudioContext API instead of MediaRecorder API);
|
|
57469
|
+
* @param {String} opts[].workerPath - Relative path from index.html.
|
|
57470
|
+
* @param {Number} opts[].timeslice=1000 - The minimum number of milliseconds of data to return in a single Blob, fire 'ondataavaible' callback (isn't need to use with 'audio/wav' of 'audio/mp3').
|
|
57471
|
+
* @param {Boolean} opts[].ignoreMutedMedia=true - What to do with a muted input MediaStreamTrack, e.g. insert black frames/zero audio volume in the recording or ignore altogether.
|
|
57472
|
+
* @param {Function} opts[].onstart - Called to handle the start event.
|
|
57473
|
+
* @param {Function} opts[].onstop - Called to handle the stop event.
|
|
57474
|
+
* @param {Function} opts[].onpause - Called to handle the pause event.
|
|
57475
|
+
* @param {Function} opts[].onresume - Called to handle the resume event.
|
|
57476
|
+
* @param {Function} opts[].onerror - Called to handle an ErrorEvent.
|
|
57477
|
+
* @param {Function} opts[].onchange - Called to handle the change a stream event.
|
|
57478
|
+
* @param {Function} opts[].ondataavailable - Called to handle the dataavailable event. The Blob of recorded data is contained in this event (Callback isn't supported if use 'audio/wav' of 'audio/mp3' for recording).
|
|
57479
|
+
*
|
|
57480
|
+
* @example
|
|
57481
|
+
* var opts = {
|
|
57482
|
+
* onstart: function onStart() { // Use named function.
|
|
57483
|
+
* console.log('Recorder is started');
|
|
57484
|
+
* },
|
|
57485
|
+
* onstop: function onStop(Blob) {
|
|
57486
|
+
* videoElement.src = URL.createObjectURL(blob);
|
|
57487
|
+
* },
|
|
57488
|
+
* mimeType: 'video/mp4'
|
|
57489
|
+
* };
|
|
57490
|
+
*
|
|
57491
|
+
* // uses as global variable, QBMediaRecorder is built as a UMD module.
|
|
57492
|
+
* var recorder = new QBMediaRecorder(opts);
|
|
57493
|
+
*
|
|
57494
|
+
* @example
|
|
57495
|
+
* // For record 'audio/mp3' or 'audio/wav' need to add {@link https://github.com/QuickBlox/javascript-media-recorder/blob/master/qbAudioRecorderWorker.js|'qbAudioRecorderWorker.js'} file to your project.
|
|
57496
|
+
* var opts = {
|
|
57497
|
+
* // use named function
|
|
57498
|
+
* onstart: function onStart() {
|
|
57499
|
+
* console.log('Recorder is started');
|
|
57500
|
+
* },
|
|
57501
|
+
* onstop: function onStop(Blob) {
|
|
57502
|
+
* videoElement.src = URL.createObjectURL(blob);
|
|
57503
|
+
* },
|
|
57504
|
+
* // 'audio/wav' or 'audio/mp3'
|
|
57505
|
+
* mimeType: 'audio/mp3',
|
|
57506
|
+
* // set relative path (from folder node_modules for example)
|
|
57507
|
+
* workerPath: '../node_modules/javascript-media-recorder/qbAudioRecorderWorker.js'
|
|
57508
|
+
* };
|
|
57509
|
+
*
|
|
57510
|
+
* // uses as global variable, QBMediaRecorder is built as a UMD module.
|
|
57511
|
+
* var recorder = new QBMediaRecorder(opts);
|
|
57512
|
+
*/
|
|
57513
|
+
function QBMediaRecorder(opts) {
|
|
57514
|
+
this.toggleMimeType(opts.mimeType);
|
|
57515
|
+
|
|
57516
|
+
if (opts.workerPath) {
|
|
57517
|
+
this._setCustomRecorderTools(opts.workerPath);
|
|
57518
|
+
}
|
|
57519
|
+
|
|
57520
|
+
this.timeslice = opts && opts.timeslice && isNaN(+opts.timeslice) ? opts.timeslice : 1000;
|
|
57521
|
+
this.callbacks = opts ? this._getCallbacks(opts) : {};
|
|
57522
|
+
this.recordedBlobs = [];
|
|
57523
|
+
this.ignoreMutedMedia = opts && typeof(opts.ignoreMutedMedia) === 'boolean' ? opts.ignoreMutedMedia : true;
|
|
57524
|
+
|
|
57525
|
+
this._stream = null;
|
|
57526
|
+
this._mediaRecorder = null;
|
|
57527
|
+
this._recordedChunks = [];
|
|
57528
|
+
this._keepRecording = false;
|
|
57529
|
+
}
|
|
57530
|
+
|
|
57531
|
+
/**
|
|
57532
|
+
* @param {String} mimeType - The mimeType to set as option.
|
|
57533
|
+
* @return {Boolean} - True if the MediaRecorder implementation is capable of recording Blob objects for the specified MIME type.
|
|
57534
|
+
*
|
|
57535
|
+
* @example
|
|
57536
|
+
* var opts = {
|
|
57537
|
+
* onstart: function onStart() {
|
|
57538
|
+
* console.log('Recorder is started');
|
|
57539
|
+
* },
|
|
57540
|
+
* onstop: function onStop(Blob) {
|
|
57541
|
+
* videoElement.src = URL.createObjectURL(blob);
|
|
57542
|
+
* },
|
|
57543
|
+
* mimeType: 'video/mp4',
|
|
57544
|
+
* // set the path to the worker before if 'audio/wav' or 'audio/mp3' mimeTypes will be used.
|
|
57545
|
+
* workerPath: '../node_modules/javascript-media-recorder/qbAudioRecorderWorker.js'
|
|
57546
|
+
* };
|
|
57547
|
+
*
|
|
57548
|
+
* var recorder = new QBMediaRecorder(opts);
|
|
57549
|
+
*
|
|
57550
|
+
* recorder.toggleMimeType('audio/mp3');
|
|
57551
|
+
*/
|
|
57552
|
+
QBMediaRecorder.prototype.toggleMimeType = function(mimeType) {
|
|
57553
|
+
var prefferedMimeType = mimeType ? mimeType : false;
|
|
57554
|
+
|
|
57555
|
+
this._customMimeType = (prefferedMimeType === 'audio/wav') ? 'audio/wav' :
|
|
57556
|
+
(prefferedMimeType === 'audio/mp3') ? 'audio/mp3' : false;
|
|
57557
|
+
|
|
57558
|
+
if (!QBMediaRecorder.isAvailable() && !this._customMimeType) {
|
|
57559
|
+
throw new Error(ERRORS.unsupport);
|
|
57560
|
+
}
|
|
57561
|
+
|
|
57562
|
+
this.mimeType = this._customMimeType ? this._customMimeType : this._getMimeType(prefferedMimeType);
|
|
57563
|
+
};
|
|
57564
|
+
|
|
57565
|
+
QBMediaRecorder.prototype._setCustomRecorderTools = function(path) {
|
|
57566
|
+
var self = this;
|
|
57567
|
+
|
|
57568
|
+
// init worker for custom audio types (audio/wav, audio/mp3)
|
|
57569
|
+
try {
|
|
57570
|
+
self._worker = new Worker(path);
|
|
57571
|
+
|
|
57572
|
+
self._postMessageToWorker({
|
|
57573
|
+
cmd: 'init',
|
|
57574
|
+
mimeType: self.mimeType
|
|
57575
|
+
});
|
|
57576
|
+
|
|
57577
|
+
self._worker.onmessage = function(event) {
|
|
57578
|
+
self._createBlob(event.data);
|
|
57579
|
+
self._closeAudioProcess();
|
|
57580
|
+
};
|
|
57581
|
+
|
|
57582
|
+
if (!QBMediaRecorder.isAudioContext()) {
|
|
57583
|
+
throw new Error(ERRORS.unsupportAudioContext);
|
|
57584
|
+
}
|
|
57585
|
+
|
|
57586
|
+
/*
|
|
57587
|
+
* context = new AudioContext();
|
|
57588
|
+
* context.createScriptProcessor(bufferSize, numberOfInputChannels, numberOfOutputChannels);
|
|
57589
|
+
*
|
|
57590
|
+
* link: https://developer.mozilla.org/ru/docs/Web/API/AudioContext/createScriptProcessor
|
|
57591
|
+
*/
|
|
57592
|
+
self.BUFFER_SIZE = 2048; // the buffer size in units of sample-frames.
|
|
57593
|
+
self.INPUT_CHANNELS = 1; // the number of channels for this node's input, defaults to 2
|
|
57594
|
+
self.OUTPUT_CHANNELS = 1; // the number of channels for this node's output, defaults to 2
|
|
57595
|
+
self._audioContext = null;
|
|
57596
|
+
} catch(e) {
|
|
57597
|
+
throw new Error(ERRORS.unsupportCustomAudioRecorder, e);
|
|
57598
|
+
}
|
|
57599
|
+
};
|
|
57600
|
+
|
|
57601
|
+
QBMediaRecorder.prototype._getMimeType = function (preffered) {
|
|
57602
|
+
var mimeType,
|
|
57603
|
+
type = 'video';
|
|
57604
|
+
|
|
57605
|
+
if(preffered && QBMediaRecorder.isTypeSupported(preffered)) {
|
|
57606
|
+
mimeType = preffered;
|
|
57607
|
+
} else if(preffered) {
|
|
57608
|
+
type = preffered.toString().toLowerCase().indexOf('audio') === -1 ? 'video' : 'audio';
|
|
57609
|
+
mimeType = QBMediaRecorder.getSupportedMimeTypes(type)[0];
|
|
57610
|
+
} else {
|
|
57611
|
+
mimeType = QBMediaRecorder.getSupportedMimeTypes(type)[0];
|
|
57612
|
+
}
|
|
57613
|
+
|
|
57614
|
+
return mimeType;
|
|
57615
|
+
};
|
|
57616
|
+
|
|
57617
|
+
QBMediaRecorder.prototype._getCallbacks = function(opts) {
|
|
57618
|
+
var callbacks = {},
|
|
57619
|
+
callbackNames = ['onstart', 'onstop', 'onpause', 'onresume', 'onerror', 'onchange', 'ondataavailable'];
|
|
57620
|
+
|
|
57621
|
+
callbackNames.forEach(function(name) {
|
|
57622
|
+
if (name in opts) {
|
|
57623
|
+
callbacks[name] = opts[name];
|
|
57624
|
+
}
|
|
57625
|
+
});
|
|
57626
|
+
|
|
57627
|
+
return callbacks;
|
|
57628
|
+
};
|
|
57629
|
+
|
|
57630
|
+
QBMediaRecorder._mimeTypes = __webpack_require__(9808);
|
|
57631
|
+
|
|
57632
|
+
QBMediaRecorder._STATES = ['inactive', 'recording', 'paused'];
|
|
57633
|
+
|
|
57634
|
+
/**
|
|
57635
|
+
* It checks capability of recording in the environment.
|
|
57636
|
+
* Checks MediaRecorder, MediaRecorder.isTypeSupported and Blob.
|
|
57637
|
+
* @return {Boolean} Returns true if the QBMediaRecorder is available and can run, or false otherwise.
|
|
57638
|
+
*
|
|
57639
|
+
* @example
|
|
57640
|
+
* if(QBMediaRecorder.isAvailable()) {
|
|
57641
|
+
* // ... show UI for recording
|
|
57642
|
+
* }
|
|
57643
|
+
*/
|
|
57644
|
+
QBMediaRecorder.isAvailable = function() {
|
|
57645
|
+
return !!(window && window.MediaRecorder && typeof window.MediaRecorder.isTypeSupported === 'function' && window.Blob);
|
|
57646
|
+
};
|
|
57647
|
+
|
|
57648
|
+
/**
|
|
57649
|
+
* It checks the AudioContext API.
|
|
57650
|
+
* Checks window.AudioContext or window.webkitAudioContext.
|
|
57651
|
+
* @return {Boolean} Returns true if the AudioContext API is available in a browser, or false otherwise.
|
|
57652
|
+
*
|
|
57653
|
+
* @example
|
|
57654
|
+
* if(QBMediaRecorder.isAudioContext()) {
|
|
57655
|
+
* // ... the QBMediaRecorder is available for recording 'audio/mp3' or 'audio/wav'
|
|
57656
|
+
* }
|
|
57657
|
+
*/
|
|
57658
|
+
QBMediaRecorder.isAudioContext = function() {
|
|
57659
|
+
return !!(window && (window.AudioContext || window.webkitAudioContext));
|
|
57660
|
+
};
|
|
57661
|
+
|
|
57662
|
+
/**
|
|
57663
|
+
* Returns a Boolean which is true if the MIME type specified is one the user agent can record.
|
|
57664
|
+
* @param {String} mimeType - The mimeType to check.
|
|
57665
|
+
* @return {Boolean} - True if the MediaRecorder implementation is capable of recording Blob objects for the specified MIME type.
|
|
57666
|
+
*
|
|
57667
|
+
* @example
|
|
57668
|
+
* if( QBMediaRecorder.isTypeSupported('video/mp4') ) {
|
|
57669
|
+
* el.textContent = 'Will be record in video/mp4';
|
|
57670
|
+
* }
|
|
57671
|
+
*/
|
|
57672
|
+
QBMediaRecorder.isTypeSupported = function(mimeType) {
|
|
57673
|
+
var result = false;
|
|
57674
|
+
|
|
57675
|
+
if(!QBMediaRecorder.isAvailable()) {
|
|
57676
|
+
throw new Error(ERRORS.unsupport);
|
|
57677
|
+
}
|
|
57678
|
+
|
|
57679
|
+
if(!mimeType) {
|
|
57680
|
+
throw new Error(ERRORS.requreArgument);
|
|
57681
|
+
}
|
|
57682
|
+
|
|
57683
|
+
switch(mimeType) {
|
|
57684
|
+
case 'audio/wav':
|
|
57685
|
+
if (QBMediaRecorder.isAudioContext()) {
|
|
57686
|
+
result = true;
|
|
57687
|
+
}
|
|
57688
|
+
break;
|
|
57689
|
+
|
|
57690
|
+
case 'audio/mp3':
|
|
57691
|
+
if (QBMediaRecorder.isAudioContext()) {
|
|
57692
|
+
result = true;
|
|
57693
|
+
}
|
|
57694
|
+
break;
|
|
57695
|
+
|
|
57696
|
+
default:
|
|
57697
|
+
result = window.MediaRecorder.isTypeSupported(mimeType);
|
|
57698
|
+
break;
|
|
57699
|
+
}
|
|
57700
|
+
|
|
57701
|
+
return result;
|
|
57702
|
+
};
|
|
57703
|
+
|
|
57704
|
+
/**
|
|
57705
|
+
* Return all supported mime types and container format.
|
|
57706
|
+
* @param {String} [type=video] Type of media.
|
|
57707
|
+
* @return {Array} Array of supported mimetypes. Recommended mimetype has 0 index.
|
|
57708
|
+
*
|
|
57709
|
+
* @example
|
|
57710
|
+
* var type = QBMediaRecorder.getSupportedMimeTypes('audio');
|
|
57711
|
+
* console.info(`Call will recording in ${type[0]}`);
|
|
57712
|
+
*/
|
|
57713
|
+
QBMediaRecorder.getSupportedMimeTypes = function(type) {
|
|
57714
|
+
var typeMedia = type || 'video';
|
|
57715
|
+
|
|
57716
|
+
if (!QBMediaRecorder.isAvailable()) {
|
|
57717
|
+
throw new Error(ERRORS.unsupport);
|
|
57718
|
+
}
|
|
57719
|
+
|
|
57720
|
+
return QBMediaRecorder._mimeTypes[typeMedia].filter(function(mimeType) {
|
|
57721
|
+
return QBMediaRecorder.isTypeSupported(mimeType);
|
|
57722
|
+
});
|
|
57723
|
+
};
|
|
57724
|
+
|
|
57725
|
+
/**
|
|
57726
|
+
* Return the current [state of QBMediaRecorder instance](https://w3c.github.io/mediacapture-record/MediaRecorder.html#idl-def-recordingstate).
|
|
57727
|
+
* Possibly states: **inactive**, **recording**, **paused**.
|
|
57728
|
+
* @return {String} Name of a state.
|
|
57729
|
+
*
|
|
57730
|
+
* @example
|
|
57731
|
+
* var recorder = new QBMediaRecorder();
|
|
57732
|
+
* // ...some code
|
|
57733
|
+
*
|
|
57734
|
+
* if(recorder.getState() == 'recording') {
|
|
57735
|
+
* console.info('You are still recording.');
|
|
57736
|
+
* }
|
|
57737
|
+
*/
|
|
57738
|
+
QBMediaRecorder.prototype.getState = function() {
|
|
57739
|
+
return this._mediaRecorder ? this._mediaRecorder.state : QBMediaRecorder._STATES[0];
|
|
57740
|
+
};
|
|
57741
|
+
|
|
57742
|
+
|
|
57743
|
+
/**
|
|
57744
|
+
* Start to recording a stream.
|
|
57745
|
+
* Fire the method `stop` if an instance inprogress (has a state recording or paused).
|
|
57746
|
+
* Fire onstart callback.
|
|
57747
|
+
* @param {MediaStream} stream - Stream object representing a flux of audio- or video-related data.
|
|
57748
|
+
* @returns {void}
|
|
57749
|
+
*
|
|
57750
|
+
* @example
|
|
57751
|
+
* var options = {
|
|
57752
|
+
* onstart: function onStart() {
|
|
57753
|
+
* var time = 0,
|
|
57754
|
+
* step = 1000;
|
|
57755
|
+
*
|
|
57756
|
+
* setTimeout(function () {
|
|
57757
|
+
* time += step;
|
|
57758
|
+
* console.info(`You are recording ${time} sec.`);
|
|
57759
|
+
* }, step);
|
|
57760
|
+
* }
|
|
57761
|
+
* }
|
|
57762
|
+
*
|
|
57763
|
+
* var rec = new qbRecorder(options);
|
|
57764
|
+
* // ...
|
|
57765
|
+
* rec.start(stream);
|
|
57766
|
+
*/
|
|
57767
|
+
QBMediaRecorder.prototype.start = function(stream) {
|
|
57768
|
+
var self = this;
|
|
57769
|
+
|
|
57770
|
+
if(!stream) {
|
|
57771
|
+
throw new Error(ERRORS.requreArgument);
|
|
57772
|
+
}
|
|
57773
|
+
|
|
57774
|
+
var mediaRecorderState = this.getState();
|
|
57775
|
+
|
|
57776
|
+
if(mediaRecorderState === QBMediaRecorder._STATES[1] || mediaRecorderState === QBMediaRecorder._STATES[2]) {
|
|
57777
|
+
this._mediaRecorder.stop();
|
|
57778
|
+
}
|
|
57779
|
+
|
|
57780
|
+
if(this._stream) {
|
|
57781
|
+
this._stream = null;
|
|
57782
|
+
}
|
|
57783
|
+
// TODO: need to stream.clone
|
|
57784
|
+
self._stream = stream;
|
|
57785
|
+
self._mediaRecorder = null;
|
|
57786
|
+
self._recordedChunks.length = 0;
|
|
57787
|
+
|
|
57788
|
+
if (self._customMimeType) {
|
|
57789
|
+
self._setCustomRecorder();
|
|
57790
|
+
} else {
|
|
57791
|
+
self._setMediaRecorder();
|
|
57792
|
+
}
|
|
57793
|
+
self._setEvents();
|
|
57794
|
+
};
|
|
57795
|
+
|
|
57796
|
+
QBMediaRecorder.prototype._setMediaRecorder = function () {
|
|
57797
|
+
var self = this;
|
|
57798
|
+
|
|
57799
|
+
try {
|
|
57800
|
+
self._mediaRecorder = new window.MediaRecorder(self._stream, {
|
|
57801
|
+
'mimeType': self.mimeType,
|
|
57802
|
+
'ignoreMutedMedia': self.ignoreMutedMedia
|
|
57803
|
+
});
|
|
57804
|
+
} catch(e) {
|
|
57805
|
+
console.warn(ERRORS.unsupportMediaRecorderWithOptions, e);
|
|
57806
|
+
|
|
57807
|
+
self._mediaRecorder = new window.MediaRecorder(self._stream);
|
|
57808
|
+
}
|
|
57809
|
+
};
|
|
57810
|
+
|
|
57811
|
+
QBMediaRecorder.prototype._setCustomRecorder = function() {
|
|
57812
|
+
var self = this;
|
|
57813
|
+
|
|
57814
|
+
self._closeAudioProcess();
|
|
57815
|
+
|
|
57816
|
+
self._mediaRecorder = {
|
|
57817
|
+
start: function() {
|
|
57818
|
+
try {
|
|
57819
|
+
this.state = QBMediaRecorder._STATES[1];
|
|
57820
|
+
self._startAudioProcess();
|
|
57821
|
+
this.onstart();
|
|
57822
|
+
} catch(error) {
|
|
57823
|
+
this.onerror(error);
|
|
57824
|
+
}
|
|
57825
|
+
},
|
|
57826
|
+
|
|
57827
|
+
stop: function() {
|
|
57828
|
+
try {
|
|
57829
|
+
this.state = QBMediaRecorder._STATES[0];
|
|
57830
|
+
self._stopAudioProcess();
|
|
57831
|
+
this.onstop();
|
|
57832
|
+
} catch(error) {
|
|
57833
|
+
this.onerror(error);
|
|
57834
|
+
}
|
|
57835
|
+
},
|
|
57836
|
+
|
|
57837
|
+
pause: function() {
|
|
57838
|
+
try {
|
|
57839
|
+
this.state = QBMediaRecorder._STATES[2];
|
|
57840
|
+
this.onpause();
|
|
57841
|
+
} catch(error) {
|
|
57842
|
+
this.onerror(error);
|
|
57843
|
+
}
|
|
57844
|
+
},
|
|
57845
|
+
|
|
57846
|
+
resume: function() {
|
|
57847
|
+
try {
|
|
57848
|
+
this.state = QBMediaRecorder._STATES[1];
|
|
57849
|
+
this.onresume();
|
|
57850
|
+
} catch(error) {
|
|
57851
|
+
this.onerror(error);
|
|
57852
|
+
}
|
|
57853
|
+
},
|
|
57854
|
+
|
|
57855
|
+
/* callbacks */
|
|
57856
|
+
onstart: function() {
|
|
57857
|
+
if (this.state !== 'recording') {
|
|
57858
|
+
this.state = QBMediaRecorder._STATES[1];
|
|
57859
|
+
}
|
|
57860
|
+
},
|
|
57861
|
+
|
|
57862
|
+
onstop: function() {
|
|
57863
|
+
if (this.state !== 'inactive') {
|
|
57864
|
+
this.state = QBMediaRecorder._STATES[0];
|
|
57865
|
+
}
|
|
57866
|
+
},
|
|
57867
|
+
|
|
57868
|
+
onpause: function() {
|
|
57869
|
+
if (this.state !== 'paused') {
|
|
57870
|
+
this.state = QBMediaRecorder._STATES[2];
|
|
57871
|
+
}
|
|
57872
|
+
},
|
|
57873
|
+
|
|
57874
|
+
onresume: function() {
|
|
57875
|
+
if (this.state !== 'recording') {
|
|
57876
|
+
this.state = QBMediaRecorder._STATES[1];
|
|
57877
|
+
}
|
|
57878
|
+
},
|
|
57879
|
+
|
|
57880
|
+
onerror: function() {
|
|
57881
|
+
try {
|
|
57882
|
+
self._closeAudioProcess();
|
|
57883
|
+
} catch(error) {
|
|
57884
|
+
throw new Error(error);
|
|
57885
|
+
}
|
|
57886
|
+
}
|
|
57887
|
+
};
|
|
57888
|
+
};
|
|
57889
|
+
|
|
57890
|
+
QBMediaRecorder.prototype._fireCallback = function(name, args) {
|
|
57891
|
+
var self = this;
|
|
57892
|
+
|
|
57893
|
+
if(Object.keys(self.callbacks).length !== 0 && typeof self.callbacks[name] === 'function') {
|
|
57894
|
+
try {
|
|
57895
|
+
self.callbacks[name](args);
|
|
57896
|
+
} catch(e) {
|
|
57897
|
+
console.error('Founded an error in callback:' + name, e);
|
|
57898
|
+
}
|
|
57899
|
+
}
|
|
57900
|
+
};
|
|
57901
|
+
|
|
57902
|
+
QBMediaRecorder.prototype._setEvents = function() {
|
|
57903
|
+
var self = this;
|
|
57904
|
+
|
|
57905
|
+
if (!self._customMimeType) {
|
|
57906
|
+
self._mediaRecorder.ondataavailable = function(e) {
|
|
57907
|
+
if(e.data && e.data.size > 0) {
|
|
57908
|
+
self._recordedChunks.push(e.data);
|
|
57909
|
+
self._fireCallback('ondataavailable', e);
|
|
57910
|
+
}
|
|
57911
|
+
};
|
|
57912
|
+
}
|
|
57913
|
+
|
|
57914
|
+
self._mediaRecorder.onpause = function() {
|
|
57915
|
+
self._fireCallback('onpause');
|
|
57916
|
+
};
|
|
57917
|
+
|
|
57918
|
+
self._mediaRecorder.onresume = function() {
|
|
57919
|
+
self._fireCallback('onresume');
|
|
57920
|
+
};
|
|
57921
|
+
|
|
57922
|
+
self._mediaRecorder.onerror = function(error) {
|
|
57923
|
+
switch(error.name) {
|
|
57924
|
+
case 'InvalidState':
|
|
57925
|
+
console.error(ERRORS[error.name]);
|
|
57926
|
+
break;
|
|
57927
|
+
|
|
57928
|
+
case 'OutOfMemory':
|
|
57929
|
+
console.error(ERRORS[error.name]);
|
|
57930
|
+
break;
|
|
57931
|
+
|
|
57932
|
+
case 'IllegalStreamModification':
|
|
57933
|
+
console.error(ERRORS[error.name]);
|
|
57934
|
+
break;
|
|
57935
|
+
|
|
57936
|
+
case 'OtherRecordingError':
|
|
57937
|
+
console.error(ERRORS[error.name]);
|
|
57938
|
+
break;
|
|
57939
|
+
|
|
57940
|
+
case 'GenericError':
|
|
57941
|
+
console.error(ERRORS[error.name]);
|
|
57942
|
+
break;
|
|
57943
|
+
|
|
57944
|
+
default:
|
|
57945
|
+
console.error('MediaRecorder Error', error);
|
|
57946
|
+
break;
|
|
57947
|
+
}
|
|
57948
|
+
|
|
57949
|
+
if (self._mediaRecorder.state !== 'inactive') {
|
|
57950
|
+
self._mediaRecorder.stop();
|
|
57951
|
+
}
|
|
57952
|
+
|
|
57953
|
+
if (self._userCallbacks && typeof self._userCallbacks.onErrorRecording === 'function') {
|
|
57954
|
+
self._fireCallback('onerror', error);
|
|
57955
|
+
}
|
|
57956
|
+
};
|
|
57957
|
+
|
|
57958
|
+
self._mediaRecorder.onstop = function() {
|
|
57959
|
+
if (self._customMimeType) {
|
|
57960
|
+
self._stopAudioProcess();
|
|
57961
|
+
} else {
|
|
57962
|
+
self._createBlob(self._recordedChunks);
|
|
57963
|
+
}
|
|
57964
|
+
};
|
|
57965
|
+
|
|
57966
|
+
self._mediaRecorder.start(self.timeslice);
|
|
57967
|
+
|
|
57968
|
+
self._fireCallback('onstart');
|
|
57969
|
+
};
|
|
57970
|
+
|
|
57971
|
+
/**
|
|
57972
|
+
* Stop to recording a stream.
|
|
57973
|
+
* @return {Blob} Blob of recorded chuncks.
|
|
57974
|
+
*/
|
|
57975
|
+
QBMediaRecorder.prototype.stop = function() {
|
|
57976
|
+
var mediaRecorder = this._mediaRecorder,
|
|
57977
|
+
mediaRecorderState = mediaRecorder && mediaRecorder.state ? mediaRecorder.state : 'inactive';
|
|
57978
|
+
|
|
57979
|
+
if(mediaRecorder && (mediaRecorderState === 'recording' || mediaRecorderState === 'paused')){
|
|
57980
|
+
mediaRecorder.stop();
|
|
57981
|
+
} else {
|
|
57982
|
+
console.warn(ERRORS.actionFailed);
|
|
57983
|
+
}
|
|
57984
|
+
};
|
|
57985
|
+
|
|
57986
|
+
/**
|
|
57987
|
+
* Pause to recording a stream.
|
|
57988
|
+
* @returns {void}
|
|
57989
|
+
*/
|
|
57990
|
+
QBMediaRecorder.prototype.pause = function() {
|
|
57991
|
+
var self = this;
|
|
57992
|
+
|
|
57993
|
+
if(self._mediaRecorder && self._mediaRecorder.state === 'recording') {
|
|
57994
|
+
self._mediaRecorder.pause();
|
|
57995
|
+
} else {
|
|
57996
|
+
console.warn(ERRORS.actionFailed);
|
|
57997
|
+
}
|
|
57998
|
+
};
|
|
57999
|
+
|
|
58000
|
+
/**
|
|
58001
|
+
* Resume to recording a stream.
|
|
58002
|
+
* @returns {void}
|
|
58003
|
+
*/
|
|
58004
|
+
QBMediaRecorder.prototype.resume = function() {
|
|
58005
|
+
var self = this;
|
|
58006
|
+
|
|
58007
|
+
if(self._mediaRecorder && self._mediaRecorder.state === 'paused') {
|
|
58008
|
+
self._mediaRecorder.resume();
|
|
58009
|
+
} else {
|
|
58010
|
+
console.warn(ERRORS.actionFailed);
|
|
58011
|
+
}
|
|
58012
|
+
};
|
|
58013
|
+
|
|
58014
|
+
/**
|
|
58015
|
+
* Change a recorded stream.
|
|
58016
|
+
* @param {MediaStream} stream - Stream object representing a flux of audio- or video-related data.
|
|
58017
|
+
* @returns {void}
|
|
58018
|
+
*/
|
|
58019
|
+
QBMediaRecorder.prototype.change = function(stream) {
|
|
58020
|
+
var self = this;
|
|
58021
|
+
|
|
58022
|
+
if(!stream) {
|
|
58023
|
+
throw new Error(ERRORS.requreArgument);
|
|
58024
|
+
}
|
|
58025
|
+
|
|
58026
|
+
self._keepRecording = true; // don't stop a record
|
|
58027
|
+
self.stop();
|
|
58028
|
+
|
|
58029
|
+
self._stream = null;
|
|
58030
|
+
self._mediaRecorder = null;
|
|
58031
|
+
|
|
58032
|
+
// TODO stream.clone
|
|
58033
|
+
self._stream = stream;
|
|
58034
|
+
|
|
58035
|
+
if (self._customMimeType) {
|
|
58036
|
+
self._setCustomRecorder();
|
|
58037
|
+
} else {
|
|
58038
|
+
self._setMediaRecorder();
|
|
58039
|
+
}
|
|
58040
|
+
|
|
58041
|
+
self._setEvents();
|
|
58042
|
+
};
|
|
58043
|
+
|
|
58044
|
+
/**
|
|
58045
|
+
* Create a file from blob and download as the file. Its method will fire 'stop' if recording in progress.
|
|
58046
|
+
* @param {Strint} [fileName=Date.now()] - Name of file.
|
|
58047
|
+
* @param {Blob} [blob] - You can set blob which you get from the method `stop` or don't set anything and we will get recorded chuncks.
|
|
58048
|
+
* @returns {void}
|
|
58049
|
+
*
|
|
58050
|
+
* @example
|
|
58051
|
+
* var rec = new qbRecorder();
|
|
58052
|
+
* rec.start(stream);
|
|
58053
|
+
* // ...
|
|
58054
|
+
* rec.download(false); // Set false, name will be generated based on Date.now()
|
|
58055
|
+
*/
|
|
58056
|
+
QBMediaRecorder.prototype.download = function(fileName, blob) {
|
|
58057
|
+
var self = this;
|
|
58058
|
+
|
|
58059
|
+
var mediaRecorderState = this.getState();
|
|
58060
|
+
|
|
58061
|
+
if(mediaRecorderState === QBMediaRecorder._STATES[1] || mediaRecorderState === QBMediaRecorder._STATES[2]) {
|
|
58062
|
+
this._mediaRecorder.stop();
|
|
58063
|
+
}
|
|
58064
|
+
|
|
58065
|
+
var url = URL.createObjectURL(blob || self._getBlobRecorded()),
|
|
58066
|
+
a = document.createElement('a');
|
|
58067
|
+
|
|
58068
|
+
a.style.display = 'none';
|
|
58069
|
+
a.href = url;
|
|
58070
|
+
a.download = (fileName || Date.now()) + '.' + self._getExtension();
|
|
58071
|
+
|
|
58072
|
+
document.body.appendChild(a);
|
|
58073
|
+
|
|
58074
|
+
// Start dowloading
|
|
58075
|
+
a.click();
|
|
58076
|
+
|
|
58077
|
+
// Remove link
|
|
58078
|
+
setTimeout(function() {
|
|
58079
|
+
document.body.removeChild(a);
|
|
58080
|
+
window.URL.revokeObjectURL(url);
|
|
58081
|
+
}, 100);
|
|
58082
|
+
};
|
|
58083
|
+
|
|
58084
|
+
QBMediaRecorder.prototype._createBlob = function(chunks) {
|
|
58085
|
+
var self = this;
|
|
58086
|
+
|
|
58087
|
+
var blob = new Blob(chunks, {
|
|
58088
|
+
'type' : self.mimeType
|
|
58089
|
+
});
|
|
58090
|
+
|
|
58091
|
+
self.recordedBlobs.push(blob);
|
|
58092
|
+
|
|
58093
|
+
if(!self._keepRecording) {
|
|
58094
|
+
if(self.recordedBlobs.length > 1) {
|
|
58095
|
+
self._fireCallback('onstop', blob);
|
|
58096
|
+
} else {
|
|
58097
|
+
self._fireCallback('onstop', self.recordedBlobs[0]);
|
|
58098
|
+
}
|
|
58099
|
+
}
|
|
58100
|
+
|
|
58101
|
+
self._keepRecording = false;
|
|
58102
|
+
};
|
|
58103
|
+
|
|
58104
|
+
/**
|
|
58105
|
+
* Create a Blob from recorded chunks.
|
|
58106
|
+
* @access private
|
|
58107
|
+
* @param {Object} [data] - Recorded data.
|
|
58108
|
+
* @return {Object} - Blob of recorded media or what you set in data
|
|
58109
|
+
*/
|
|
58110
|
+
QBMediaRecorder.prototype._getBlobRecorded = function(data) {
|
|
58111
|
+
var self = this,
|
|
58112
|
+
chunks = data || self._recordedChunks;
|
|
58113
|
+
|
|
58114
|
+
if(!chunks.length) {
|
|
58115
|
+
console.warn(ERRORS.no_recorded_chunks);
|
|
58116
|
+
return false;
|
|
58117
|
+
}
|
|
58118
|
+
|
|
58119
|
+
return new Blob(chunks, { 'type' : self.mimeType });
|
|
58120
|
+
};
|
|
58121
|
+
|
|
58122
|
+
/**
|
|
58123
|
+
* Return a extension of a file. Based on available mimeType.
|
|
58124
|
+
* @access private
|
|
58125
|
+
* @return {String} For example, 'webm' / 'mp4' / 'ogg'
|
|
58126
|
+
*/
|
|
58127
|
+
QBMediaRecorder.prototype._getExtension = function() {
|
|
58128
|
+
var self = this;
|
|
58129
|
+
|
|
58130
|
+
var endTypeMedia = self.mimeType.indexOf('/'),
|
|
58131
|
+
extension = self.mimeType.substring(endTypeMedia + 1),
|
|
58132
|
+
startCodecsInfo = extension.indexOf(';');
|
|
58133
|
+
|
|
58134
|
+
if(startCodecsInfo !== -1) {
|
|
58135
|
+
extension = extension.substring(0, startCodecsInfo);
|
|
58136
|
+
}
|
|
58137
|
+
|
|
58138
|
+
return extension;
|
|
58139
|
+
};
|
|
58140
|
+
|
|
58141
|
+
|
|
58142
|
+
QBMediaRecorder.prototype._startAudioProcess = function() {
|
|
58143
|
+
if(!QBMediaRecorder.isAudioContext()) {
|
|
58144
|
+
throw new Error(ERRORS.unsupport);
|
|
58145
|
+
}
|
|
58146
|
+
|
|
58147
|
+
var self = this,
|
|
58148
|
+
audioContext,
|
|
58149
|
+
audioInput,
|
|
58150
|
+
recorder,
|
|
58151
|
+
volume;
|
|
58152
|
+
|
|
58153
|
+
self._closeAudioProcess();
|
|
58154
|
+
|
|
58155
|
+
audioContext = window.AudioContext || window.webkitAudioContext;
|
|
58156
|
+
self._audioContext = new audioContext;
|
|
58157
|
+
|
|
58158
|
+
volume = self._audioContext.createGain();
|
|
58159
|
+
audioInput = self._audioContext.createMediaStreamSource(self._stream);
|
|
58160
|
+
recorder = self._audioContext.createScriptProcessor(self.BUFFER_SIZE, self.INPUT_CHANNELS, self.OUTPUT_CHANNELS);
|
|
58161
|
+
audioInput.connect(volume);
|
|
58162
|
+
|
|
58163
|
+
self._postMessageToWorker({
|
|
58164
|
+
cmd: 'init',
|
|
58165
|
+
mimeType: self.mimeType,
|
|
58166
|
+
sampleRate: audioInput.context.sampleRate
|
|
58167
|
+
});
|
|
58168
|
+
|
|
58169
|
+
recorder.onaudioprocess = function(e) {
|
|
58170
|
+
if (self._mediaRecorder.state === QBMediaRecorder._STATES[1]) {
|
|
58171
|
+
self._postMessageToWorker({
|
|
58172
|
+
cmd: 'record',
|
|
58173
|
+
bufferChunk: e.inputBuffer.getChannelData(0),
|
|
58174
|
+
bufferSize: self.BUFFER_SIZE
|
|
58175
|
+
});
|
|
58176
|
+
}
|
|
58177
|
+
};
|
|
58178
|
+
|
|
58179
|
+
volume.connect(recorder);
|
|
58180
|
+
recorder.connect(self._audioContext.destination);
|
|
58181
|
+
};
|
|
58182
|
+
|
|
58183
|
+
QBMediaRecorder.prototype._closeAudioProcess = function() {
|
|
58184
|
+
var self = this;
|
|
58185
|
+
|
|
58186
|
+
if (self._audioContext) {
|
|
58187
|
+
self._audioContext.close()
|
|
58188
|
+
.then(function() {
|
|
58189
|
+
self._audioContext = null;
|
|
58190
|
+
self._postMessageToWorker({cmd: 'init', mimeType: ''});
|
|
58191
|
+
});
|
|
58192
|
+
}
|
|
58193
|
+
};
|
|
58194
|
+
|
|
58195
|
+
QBMediaRecorder.prototype._stopAudioProcess = function() {
|
|
58196
|
+
this._postMessageToWorker({cmd: 'finish'});
|
|
58197
|
+
};
|
|
58198
|
+
|
|
58199
|
+
QBMediaRecorder.prototype._postMessageToWorker = function(data) {
|
|
58200
|
+
if (this._worker) {
|
|
58201
|
+
this._worker.postMessage(data);
|
|
58202
|
+
}
|
|
58203
|
+
};
|
|
58204
|
+
|
|
58205
|
+
module.exports = QBMediaRecorder;
|
|
58206
|
+
|
|
57430
58207
|
/***/ }),
|
|
57431
58208
|
|
|
57432
58209
|
/***/ 4538:
|
|
@@ -58061,7 +58838,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.chat-container{width:100%}.chat-conta
|
|
|
58061
58838
|
|
|
58062
58839
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
58063
58840
|
// Module
|
|
58064
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.header-dialog-info,.header-dialog-info *{box-sizing:border-box}.header-dialog-info{padding:16px 16px 16px 24px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;align-self:stretch;flex-shrink:0;position:relative;border-bottom:1px solid var(--divider);height:64px}.header-dialog-info-headline{color:var(--main-text, #0b1b0f);text-align:left;font:var(--title-title-large);position:relative}.header-dialog-info-icon{width:24px;height:24px;fill:var(--secondary-elements)}.dialog-information-profile,.dialog-information-profile *{box-sizing:border-box}.dialog-information-profile{padding:24px 0px 24px 0px;align-self:stretch;flex-flow:column;flex-shrink:0;height:160px;position:relative;border-bottom:1px solid var(--divider)}.dialog-information-profile-avatar{height:80px;left:140px;top:24px}.dialog-info-profile-avatar-default-icon{display:flex;justify-content:center}.dialog-info-profile-avatar-ellipse{border-radius:50%;position:absolute;height:81px;width:81px;top:24px}.dialog-info-profile-avatar-contents{position:absolute;right:17.86%;left:17.86%;width:64.29%;bottom:17.86%;top:17.86%;height:64.29%;overflow:visible}.dialog-information-profile-dialog-name{margin-top:8px;color:var(--main-text, #0b1b0f);text-align:center;font:var(--title-title-medium);left:134.5px;top:112px;display:flex;align-items:center;justify-content:center}.dialog-information-profile-edit{right:-10px;border-radius:4px;padding:8px 56px 0px 0px;display:flex;flex-direction:row;gap:0;align-items:center;justify-content:center;position:absolute;top:8px}.dialog-information-profile-edit-button{color:var(--main-elements, #3978fc);text-align:left;font:var(--button-default);position:relative}.dialog-information-profile-edit-button--disable{color:var(--disabled-elements);cursor:default}.dialog-info-action-wrapper-settings,.dialog-info-action-wrapper-settings *{box-sizing:border-box}.dialog-info-action-wrapper-settings{
|
|
58841
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.header-dialog-info,.header-dialog-info *{box-sizing:border-box}.header-dialog-info{padding:16px 16px 16px 24px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;align-self:stretch;flex-shrink:0;position:relative;border-bottom:1px solid var(--divider);height:64px}.header-dialog-info-headline{color:var(--main-text, #0b1b0f);text-align:left;font:var(--title-title-large);position:relative}.header-dialog-info-icon{width:24px;height:24px;fill:var(--secondary-elements)}.dialog-information-profile,.dialog-information-profile *{box-sizing:border-box}.dialog-information-profile{padding:24px 0px 24px 0px;align-self:stretch;flex-flow:column;flex-shrink:0;height:160px;position:relative;border-bottom:1px solid var(--divider)}.dialog-information-profile-avatar{height:80px;left:140px;top:24px}.dialog-info-profile-avatar-default-icon{display:flex;justify-content:center}.dialog-info-profile-avatar-ellipse{border-radius:50%;position:absolute;height:81px;width:81px;top:24px}.dialog-info-profile-avatar-contents{position:absolute;right:17.86%;left:17.86%;width:64.29%;bottom:17.86%;top:17.86%;height:64.29%;overflow:visible}.dialog-information-profile-dialog-name{margin-top:8px;color:var(--main-text, #0b1b0f);text-align:center;font:var(--title-title-medium);left:134.5px;top:112px;display:flex;align-items:center;justify-content:center}.dialog-information-profile-edit{right:-10px;border-radius:4px;padding:8px 56px 0px 0px;display:flex;flex-direction:row;gap:0;align-items:center;justify-content:center;position:absolute;top:8px}.dialog-information-profile-edit-button{color:var(--main-elements, #3978fc);text-align:left;font:var(--button-default);position:relative}.dialog-information-profile-edit-button--disable{color:var(--disabled-elements);cursor:default}.dialog-info-action-wrapper-settings,.dialog-info-action-wrapper-settings *{box-sizing:border-box}.dialog-info-action-wrapper-settings{padding:16px;display:flex;flex-direction:row;gap:16px;align-items:center;justify-content:flex-start;align-self:stretch;flex-shrink:0;position:relative;border-bottom:1px solid var(--divider)}@media only screen and (max-width: var(--min-width-screen-desktop)){.dialog-info-action-wrapper-settings{padding:6px}}.no-padding{padding:0}.dialog-info-action-wrapper-settings-icon{border-radius:4px;padding:4px;display:flex;flex-direction:row;gap:0;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;position:relative}.dialog-info-action-wrapper-settings-subtitle{color:var(--main-text, #0b1b0f);text-align:left;font:var(--body-body-large);position:relative;flex:1;display:flex;align-items:center;justify-content:flex-start}.dialog-info-action-wrapper-settings-contents{flex-shrink:0;width:24px;height:24px;position:relative;overflow:visible}.dialog-info-action-wrapper-settings-right{display:flex;flex-direction:row;gap:8px;align-items:center;justify-content:flex-end;flex-shrink:0;position:relative}.dialog-info-action-wrapper-settings-right-badge{background:var(--disabled-elements, #bcc1c5);border-radius:30px;padding:2px 6px 2px 6px;display:flex;flex-direction:column;gap:10px;align-items:center;justify-content:center;flex-shrink:0;position:relative}.dialog-info-action-wrapper-settings-right-badge-title{color:var(--color-background, #ffffff);text-align:center;font:var(--label-label-medium);position:relative;padding:0 5px 0 5px}.dialog-info-leave{fill:var(--error);border-bottom:1px solid var(--divider);cursor:pointer}.dialog-info-leave--disable{fill:var(--disabled-elements);cursor:default}.dialog-info-members{fill:var(--main-elements);border-bottom:1px solid var(--divider)}.dialog-info-action-wrapper-button{border:1px solid var(--secondary-elements);color:var(--secondary-elements)}.dialog-info-action-wrapper-button:active{border:1px solid var(--secondary-elements);color:var(--secondary-elements)}.dialog-info-action-wrapper-button:focus{border:1px solid var(--secondary-elements)}`, ""]);
|
|
58065
58842
|
// Exports
|
|
58066
58843
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
58067
58844
|
|
|
@@ -58423,7 +59200,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.dialog-list-header{font-family:"Robot
|
|
|
58423
59200
|
|
|
58424
59201
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
58425
59202
|
// Module
|
|
58426
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.dialog-preview-container{display:flex;border:1px solid var(--chat-input);gap:16px}.dialog-preview-container-left{flex:1;margin-left:10px}.dialog-preview-container-right{display:flex;align-items:center;justify-content:center;width:40px}.dialog-preview,.dialog-preview *{box-sizing:border-box}.dialog-preview{padding:6px 6px 6px 6px;display:flex;flex-direction:row;gap:16px;align-items:center;justify-content:flex-start;align-self:stretch;flex-shrink:0;position:relative}.dialog-preview-item{background:var(--color-background, #ffffff);display:flex;flex-direction:row;align-items:center;justify-content:space-between}.dialog-preview-avatar{flex-shrink:0;width:56px;height:56px;position:relative}.dialog-preview-avatar-rectangle{position:absolute;right:0%;left:0%;width:100%;bottom:0%;top:0%;height:100%}.dialog-preview-avatar-ellipse{background:var(--disabled-elements, #bcc1c5);border-radius:50%;position:absolute;right:0%;left:0%;width:100%;bottom:0%;top:0%;height:100%}.dialog-preview-avatar-contents-user{height:auto;position:absolute;right:17.86%;left:17.86%;width:64.29%;bottom:17.86%;top:17.86%;height:64.29%;overflow:visible}.dialog-preview-text{display:flex;flex-direction:column;gap:2px;align-items:flex-start;justify-content:flex-start;flex:1;position:relative}.dialog-preview-text-subtitle{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;align-self:stretch;flex-shrink:0;position:relative}.dialog-preview-text-subtitle-caption{display:flex;flex-direction:row;gap:0px;align-items:center;justify-content:flex-start;flex-shrink:0;position:relative}.dialog-preview-text-subtitle-caption-name{color:var(--main-text, #0b1b0f);text-align:left;font:var(--label-label-medium, 500 12px/16px "Roboto", sans-serif);position:relative}.dialog-item-preview-text{color:var(--main-text);text-align:left;font:var(--body-body-small, 400 12px/16px "Roboto", sans-serif);position:relative;align-self:stretch;height:32px}.dialog-preview-text-subtitle-caption2{display:flex;flex-direction:row;gap:0px;align-items:flex-start;justify-content:flex-start;flex-shrink:0;position:relative}.dialog-preview-text-subtitle-caption2-time{color:var(--tertiary-elements, #636d78);text-align:right;font:var(--label-label-small, 500 11px/16px "Roboto", sans-serif);position:relative}.dialog-preview-text-subtitle-text{color:var(--secondary-text, #636d78);text-align:left;font:var(--body-body-small, 400 12px/16px "Roboto", sans-serif);position:relative;align-self:stretch;display:inline-block;word-wrap:break-word;overflow:hidden;max-height:32px;height:32px}.dialog-preview-text-subtitle-message-badge{background:var(--main-elements, #3978fc);border-radius:30px;padding:2px 6px 2px 6px;display:flex;flex-direction:column;gap:10px;align-items:center;justify-content:center;flex-shrink:0;position:relative;height:22px}.dialog-preview-text-subtitle-message-badge-v{color:var(--color-background, #ffffff);text-align:center;font:var(--label-label-medium, 500 12px/16px "Roboto", sans-serif);position:relative}.dialog-preview-text-subtitle-message{display:flex;flex-flow:row;align-items:center;justify-content:space-between;align-self:stretch}.dialog-preview-icon-close{border-radius:4px;padding:4px;display:flex;flex-direction:row;gap:0px;align-items:center;justify-content:center;flex-shrink:0;width:12px;height:22px;position:relative;cursor:pointer}.dpa-contents-user{height:auto;position:absolute;right:17.86%;left:17.86%;width:64.29%;bottom:17.86%;top:17.86%;height:64.29%;overflow:visible}.dialog-item-preview-border{border-style:solid;border-color:var(--color-divider, #e7efff);border-width:0 0 1px 0}`, ""]);
|
|
59203
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.dialog-preview-container{display:flex;border:1px solid var(--chat-input);gap:16px}.dialog-preview-container-left{flex:1;margin-left:10px}.dialog-preview-container-right{display:flex;align-items:center;justify-content:center;width:40px}.dialog-preview,.dialog-preview *{box-sizing:border-box}.dialog-preview{padding:6px 6px 6px 6px;display:flex;flex-direction:row;gap:16px;align-items:center;justify-content:flex-start;align-self:stretch;flex-shrink:0;position:relative}.dialog-preview-item{background:var(--color-background, #ffffff);display:flex;flex-direction:row;align-items:center;justify-content:space-between}.dialog-preview-avatar{flex-shrink:0;width:56px;height:56px;position:relative}.dialog-preview-avatar-rectangle{position:absolute;right:0%;left:0%;width:100%;bottom:0%;top:0%;height:100%}.dialog-preview-avatar-ellipse{background:var(--disabled-elements, #bcc1c5);border-radius:50%;position:absolute;right:0%;left:0%;width:100%;bottom:0%;top:0%;height:100%}.dialog-preview-avatar-contents-user{height:auto;position:absolute;right:17.86%;left:17.86%;width:64.29%;bottom:17.86%;top:17.86%;height:64.29%;overflow:visible}.dialog-preview-text{display:flex;flex-direction:column;gap:2px;align-items:flex-start;justify-content:flex-start;flex:1;position:relative}.dialog-preview-text-subtitle{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;align-self:stretch;flex-shrink:0;position:relative}.dialog-preview-text-subtitle-caption{display:flex;flex-direction:row;gap:0px;align-items:center;justify-content:flex-start;flex-shrink:0;position:relative}.dialog-preview-text-subtitle-caption-name{color:var(--main-text, #0b1b0f);text-align:left;font:var(--label-label-medium, 500 12px/16px "Roboto", sans-serif);position:relative}.dialog-item-preview-text{color:var(--main-text);text-align:left;font:var(--body-body-small, 400 12px/16px "Roboto", sans-serif);position:relative;align-self:stretch;height:32px}.dialog-preview-text-subtitle-caption2{display:flex;flex-direction:row;gap:0px;align-items:flex-start;justify-content:flex-start;flex-shrink:0;position:relative}.dialog-preview-text-subtitle-caption2-time{color:var(--tertiary-elements, #636d78);text-align:right;font:var(--label-label-small, 500 11px/16px "Roboto", sans-serif);position:relative}.dialog-preview-text-subtitle-text{color:var(--secondary-text, #636d78);text-align:left;font:var(--body-body-small, 400 12px/16px "Roboto", sans-serif);position:relative;align-self:stretch;display:inline-block;word-wrap:break-word;overflow:hidden;max-height:32px;height:32px}.dialog-preview-text-subtitle-message-badge{background:var(--main-elements, #3978fc);border-radius:30px;padding:2px 6px 2px 6px;display:flex;flex-direction:column;gap:10px;align-items:center;justify-content:center;flex-shrink:0;position:relative;height:22px}.dialog-preview-text-subtitle-message-badge-v{color:var(--color-background, #ffffff);text-align:center;font:var(--label-label-medium, 500 12px/16px "Roboto", sans-serif);position:relative}.dialog-preview-text-subtitle-message{display:flex;flex-flow:row;align-items:center;justify-content:space-between;align-self:stretch}.dialog-preview-icon-close{border-radius:4px;padding:4px;display:flex;flex-direction:row;gap:0px;align-items:center;justify-content:center;flex-shrink:0;width:12px;height:22px;position:relative;cursor:pointer}.dpa-contents-user{height:auto;position:absolute;right:17.86%;left:17.86%;width:64.29%;bottom:17.86%;top:17.86%;height:64.29%;overflow:visible}.dialog-item-preview-border{border-style:solid;border-color:var(--color-divider, #e7efff);border-width:0 0 1px 0}.dialog-preview-container-context-menu svg{fill:var(--tertiary-elements);width:24px;height:24px}`, ""]);
|
|
58427
59204
|
// Exports
|
|
58428
59205
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
58429
59206
|
|
|
@@ -59411,6 +60188,33 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.main-button {
|
|
|
59411
60188
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
59412
60189
|
|
|
59413
60190
|
|
|
60191
|
+
/***/ }),
|
|
60192
|
+
|
|
60193
|
+
/***/ 9808:
|
|
60194
|
+
/***/ ((module) => {
|
|
60195
|
+
|
|
60196
|
+
"use strict";
|
|
60197
|
+
|
|
60198
|
+
|
|
60199
|
+
module.exports = {
|
|
60200
|
+
'audio': [
|
|
60201
|
+
'audio/webm;codecs=opus',
|
|
60202
|
+
'audio/webm',
|
|
60203
|
+
'audio/ogg',
|
|
60204
|
+
'audio/mp3',
|
|
60205
|
+
'audio/wav'
|
|
60206
|
+
],
|
|
60207
|
+
'video': [
|
|
60208
|
+
'video/webm;codecs=vp9',
|
|
60209
|
+
'video/webm;codecs=vp8',
|
|
60210
|
+
'video/webm;codecs=h264',
|
|
60211
|
+
'video/webm;codecs=opus',
|
|
60212
|
+
'video/webm',
|
|
60213
|
+
'video/mp4',
|
|
60214
|
+
'video/mpeg'
|
|
60215
|
+
]
|
|
60216
|
+
};
|
|
60217
|
+
|
|
59414
60218
|
/***/ }),
|
|
59415
60219
|
|
|
59416
60220
|
/***/ 9811:
|
|
@@ -68207,8 +69011,8 @@ class UsersRepository {
|
|
|
68207
69011
|
for (let i = 0; i < usersIds.length; i += 1) {
|
|
68208
69012
|
let dto = new RemoteUserDTO();
|
|
68209
69013
|
dto.id = usersIds[i]?.toString() || '-1';
|
|
68210
|
-
// eslint-disable-next-line no-await-in-loop
|
|
68211
69014
|
try {
|
|
69015
|
+
// eslint-disable-next-line no-await-in-loop
|
|
68212
69016
|
dto = await this.remoteDataSource.getUser(dto);
|
|
68213
69017
|
}
|
|
68214
69018
|
catch (e) {
|
|
@@ -68398,6 +69202,14 @@ function useDialogListViewModel(currentContext, initPagination) {
|
|
|
68398
69202
|
}
|
|
68399
69203
|
});
|
|
68400
69204
|
}
|
|
69205
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
|
69206
|
+
function informDataSources(item) {
|
|
69207
|
+
const updateCurrentDialogInDataSourceUseCase = new UpdateCurrentDialogInDataSourceUseCase(new DialogsRepository(currentContext.storage.LOCAL_DATA_SOURCE, remoteDataSourceMock), item, QBConfig);
|
|
69208
|
+
updateCurrentDialogInDataSourceUseCase.execute().catch((e) => {
|
|
69209
|
+
console.log('Error updateCurrentDialogInDataSourceUseCase: ', parse_stringifyError(e));
|
|
69210
|
+
throw new Error(parse_stringifyError(e));
|
|
69211
|
+
});
|
|
69212
|
+
}
|
|
68401
69213
|
const dialogUpdateHandler = (dialogInfo) => {
|
|
68402
69214
|
console.log('call dialogUpdateHandler in useDialogListView:', dialogInfo);
|
|
68403
69215
|
if (dialogInfo.eventMessageType === EventMessageType.SystemMessage
|
|
@@ -68467,7 +69279,13 @@ function useDialogListViewModel(currentContext, initPagination) {
|
|
|
68467
69279
|
setDialogs((prevDialogs) => {
|
|
68468
69280
|
const newDialogs = prevDialogs.map((dialog) => {
|
|
68469
69281
|
if (dialog.id === dialogInfo.dialogInfo?.id) {
|
|
68470
|
-
|
|
69282
|
+
const updatedDialogInfo = {
|
|
69283
|
+
...dialogInfo.dialogInfo,
|
|
69284
|
+
unreadMessageCount: dialog.id === newDialog?.id
|
|
69285
|
+
? 0
|
|
69286
|
+
: dialogInfo.dialogInfo.unreadMessageCount,
|
|
69287
|
+
};
|
|
69288
|
+
return updatedDialogInfo;
|
|
68471
69289
|
}
|
|
68472
69290
|
return dialog;
|
|
68473
69291
|
});
|
|
@@ -68478,11 +69296,6 @@ function useDialogListViewModel(currentContext, initPagination) {
|
|
|
68478
69296
|
: new Date(b.updatedAt).getTime() -
|
|
68479
69297
|
new Date(a.updatedAt).getTime();
|
|
68480
69298
|
});
|
|
68481
|
-
// const sortedData = [...newDialogs].sort((a, b) => {
|
|
68482
|
-
// return (
|
|
68483
|
-
// new Date(b.lastMessage.dateSent).getTime() - new Date(a.lastMessage.dateSent).getTime()
|
|
68484
|
-
// );
|
|
68485
|
-
// });
|
|
68486
69299
|
return sortedData;
|
|
68487
69300
|
});
|
|
68488
69301
|
}
|
|
@@ -68627,14 +69440,6 @@ function useDialogListViewModel(currentContext, initPagination) {
|
|
|
68627
69440
|
});
|
|
68628
69441
|
return Promise.resolve(resultEnity);
|
|
68629
69442
|
};
|
|
68630
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
|
68631
|
-
function informDataSources(item) {
|
|
68632
|
-
const updateCurrentDialogInDataSourceUseCase = new UpdateCurrentDialogInDataSourceUseCase(new DialogsRepository(currentContext.storage.LOCAL_DATA_SOURCE, remoteDataSourceMock), item, QBConfig);
|
|
68633
|
-
updateCurrentDialogInDataSourceUseCase.execute().catch((e) => {
|
|
68634
|
-
console.log('Error updateCurrentDialogInDataSourceUseCase: ', parse_stringifyError(e));
|
|
68635
|
-
throw new Error(parse_stringifyError(e));
|
|
68636
|
-
});
|
|
68637
|
-
}
|
|
68638
69443
|
return {
|
|
68639
69444
|
get entity() {
|
|
68640
69445
|
return newDialog;
|
|
@@ -73839,7 +74644,7 @@ additionalSettings = undefined, }) => {
|
|
|
73839
74644
|
if (value === 'Leave') {
|
|
73840
74645
|
onLeaveDialog(dialogViewModel?.entity);
|
|
73841
74646
|
}
|
|
73842
|
-
}, placement: "left", children: (0,jsx_runtime_.jsx)(morereact, {}) }), onClick: () => {
|
|
74647
|
+
}, placement: "left", children: (0,jsx_runtime_.jsx)("div", { className: "dialog-preview-container-context-menu", children: (0,jsx_runtime_.jsx)(morereact, { className: "" }) }) }), onClick: () => {
|
|
73843
74648
|
if (dialogViewModel && dialogViewModel.itemClickActionHandler) {
|
|
73844
74649
|
dialogViewModel.itemClickActionHandler(dialogViewModel?.item);
|
|
73845
74650
|
}
|
|
@@ -75322,6 +76127,9 @@ const CreateNewDialogFlow = ({ dialogsViewModel, onFinished, onCancel, isOnline,
|
|
|
75322
76127
|
};
|
|
75323
76128
|
/* harmony default export */ const CreateDialogFlow_CreateNewDialogFlow = (CreateNewDialogFlow);
|
|
75324
76129
|
|
|
76130
|
+
// EXTERNAL MODULE: ./node_modules/media-recorder-js/src/index.js
|
|
76131
|
+
var media_recorder_js_src = __webpack_require__(4505);
|
|
76132
|
+
var src_default = /*#__PURE__*/__webpack_require__.n(media_recorder_js_src);
|
|
75325
76133
|
;// ./src/Presentation/components/UI/svgs/Icons/AIWidgets/AIWidget/index.tsx
|
|
75326
76134
|
|
|
75327
76135
|
function AIWidgetIcon(theme = undefined) {
|
|
@@ -77040,12 +77848,13 @@ function UseDefaultAITranslateWidgetWithSDK(dataSource, smartChatAssistantId) {
|
|
|
77040
77848
|
|
|
77041
77849
|
|
|
77042
77850
|
|
|
77851
|
+
|
|
77043
77852
|
|
|
77044
77853
|
|
|
77045
77854
|
// part 1 includes end
|
|
77046
77855
|
function useQuickBloxUIKit({ AIRephrase = undefined, AITranslate = undefined, AIAssist = undefined, uikitHeightOffset = '0px', }) {
|
|
77047
77856
|
// 103
|
|
77048
|
-
const mimeType = 'audio/webm;codecs=opus'; // audio/ogg audio/mpeg audio/webm audio/x-wav audio/mp4
|
|
77857
|
+
// const mimeType = 'audio/webm;codecs=opus'; // audio/ogg audio/mpeg audio/webm audio/x-wav audio/mp4
|
|
77049
77858
|
const messagePerPage = 47;
|
|
77050
77859
|
const currentContext = QuickBloxUIKitProvider_useQbInitializedDataContext();
|
|
77051
77860
|
const QBConfig = currentContext.InitParams.qbConfig ||
|
|
@@ -77222,10 +78031,13 @@ function useQuickBloxUIKit({ AIRephrase = undefined, AITranslate = undefined, AI
|
|
|
77222
78031
|
const [fileToSend, setFileToSend] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(null);
|
|
77223
78032
|
const [isRecording, setIsRecording] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(false);
|
|
77224
78033
|
const [permission, setPermission] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(false);
|
|
77225
|
-
|
|
77226
|
-
const
|
|
77227
|
-
const
|
|
78034
|
+
//
|
|
78035
|
+
const [stream, setStream] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(null);
|
|
78036
|
+
const mediaRecorder = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useRef)(null);
|
|
78037
|
+
const [resultAudioBlob, setResultAudioBlob] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(null);
|
|
77228
78038
|
const [audioChunks, setAudioChunks] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)([]);
|
|
78039
|
+
const [peerConnection, setPeerConnection] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(null);
|
|
78040
|
+
//
|
|
77229
78041
|
const newModal = hooks_useModal();
|
|
77230
78042
|
const [dialogToLeave, setDialogToLeave] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)();
|
|
77231
78043
|
const [showDialogList, setShowDialogList] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(true);
|
|
@@ -77316,167 +78128,129 @@ function useQuickBloxUIKit({ AIRephrase = undefined, AITranslate = undefined, AI
|
|
|
77316
78128
|
closeReplyMessageFlowHandler();
|
|
77317
78129
|
});
|
|
77318
78130
|
};
|
|
77319
|
-
|
|
77320
|
-
|
|
77321
|
-
try {
|
|
77322
|
-
const mediaStream = await navigator.mediaDevices.getUserMedia({
|
|
77323
|
-
audio: true,
|
|
77324
|
-
video: false,
|
|
77325
|
-
});
|
|
77326
|
-
setPermission(true);
|
|
77327
|
-
setStream(mediaStream);
|
|
77328
|
-
}
|
|
77329
|
-
catch (err) {
|
|
77330
|
-
showErrorMessage(`The MediaRecorder API throws exception ${parse_stringifyError(err)} .`);
|
|
77331
|
-
}
|
|
77332
|
-
}
|
|
77333
|
-
else {
|
|
77334
|
-
showErrorMessage('The MediaRecorder API is not supported in your browser.');
|
|
77335
|
-
}
|
|
77336
|
-
};
|
|
77337
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
|
|
77338
|
-
const startRecording = async () => {
|
|
77339
|
-
if (!stream)
|
|
77340
|
-
return;
|
|
77341
|
-
// Определение браузера
|
|
78131
|
+
// Detect browser and set MIME type
|
|
78132
|
+
const detectBrowserAndMimeType = () => {
|
|
77342
78133
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
77343
78134
|
const isChrome = /chrome/.test(userAgent) && !/edge|opr|brave/.test(userAgent);
|
|
77344
78135
|
const isSafari = /^((?!chrome|android).)*safari/.test(userAgent);
|
|
77345
78136
|
const isFirefox = /firefox/.test(userAgent);
|
|
77346
|
-
const
|
|
77347
|
-
|
|
77348
|
-
console.log('Browser is:',
|
|
78137
|
+
const isIOS = /iphone|ipad|ipod/.test(userAgent);
|
|
78138
|
+
console.log(`Browser detected: ${
|
|
77349
78139
|
// eslint-disable-next-line no-nested-ternary
|
|
77350
78140
|
isChrome
|
|
77351
78141
|
? 'Chrome'
|
|
77352
78142
|
: // eslint-disable-next-line no-nested-ternary
|
|
77353
78143
|
isSafari
|
|
77354
78144
|
? 'Safari'
|
|
77355
|
-
:
|
|
77356
|
-
|
|
77357
|
-
|
|
78145
|
+
: // eslint-disable-next-line no-nested-ternary
|
|
78146
|
+
isFirefox
|
|
78147
|
+
? 'Firefox'
|
|
78148
|
+
: isIOS
|
|
78149
|
+
? 'iOS'
|
|
78150
|
+
: 'Other'}`);
|
|
77358
78151
|
const mimeTypes = {
|
|
77359
78152
|
chrome: ['audio/webm;codecs=opus', 'audio/webm'],
|
|
77360
|
-
safari: ['audio/
|
|
78153
|
+
safari: ['audio/mp4', 'audio/mp4;codecs=mp4a', 'audio/aac', 'audio/wav'],
|
|
78154
|
+
ios: ['audio/mp4', 'audio/mp4;codecs=mp4a', 'audio/aac'],
|
|
77361
78155
|
firefox: ['audio/ogg', 'audio/webm'],
|
|
77362
|
-
other: ['audio/
|
|
78156
|
+
other: ['audio/webm', 'audio/mp4', 'audio/wav'],
|
|
77363
78157
|
};
|
|
77364
|
-
|
|
77365
|
-
|
|
77366
|
-
|
|
77367
|
-
|
|
77368
|
-
|
|
77369
|
-
|
|
77370
|
-
|
|
77371
|
-
|
|
77372
|
-
|
|
77373
|
-
|
|
77374
|
-
|
|
77375
|
-
|
|
77376
|
-
|
|
77377
|
-
|
|
77378
|
-
|
|
77379
|
-
|
|
77380
|
-
|
|
77381
|
-
|
|
77382
|
-
|
|
77383
|
-
|
|
77384
|
-
}
|
|
77385
|
-
console.log(`Selected MIME-type: ${mimeContent}`);
|
|
78158
|
+
// eslint-disable-next-line no-nested-ternary
|
|
78159
|
+
const targetMimeTypes = isIOS
|
|
78160
|
+
? mimeTypes.ios
|
|
78161
|
+
: // eslint-disable-next-line no-nested-ternary
|
|
78162
|
+
isSafari
|
|
78163
|
+
? mimeTypes.safari
|
|
78164
|
+
: // eslint-disable-next-line no-nested-ternary
|
|
78165
|
+
isChrome
|
|
78166
|
+
? mimeTypes.chrome
|
|
78167
|
+
: isFirefox
|
|
78168
|
+
? mimeTypes.firefox
|
|
78169
|
+
: mimeTypes.other;
|
|
78170
|
+
return (targetMimeTypes.find((type) => src_default().isTypeSupported(type)) ||
|
|
78171
|
+
'audio/wav');
|
|
78172
|
+
};
|
|
78173
|
+
// Request microphone access and setup WebRTC
|
|
78174
|
+
const getMicrophonePermission = async () => {
|
|
78175
|
+
if (!window) {
|
|
78176
|
+
showErrorMessage('The MediaRecorder API is not supported in your browser.');
|
|
78177
|
+
return;
|
|
78178
|
+
}
|
|
77386
78179
|
try {
|
|
77387
|
-
const
|
|
77388
|
-
|
|
77389
|
-
|
|
77390
|
-
|
|
77391
|
-
|
|
77392
|
-
|
|
77393
|
-
|
|
77394
|
-
|
|
78180
|
+
const mediaStream = await navigator.mediaDevices.getUserMedia({
|
|
78181
|
+
audio: true,
|
|
78182
|
+
});
|
|
78183
|
+
// Create WebRTC peer connection
|
|
78184
|
+
const pc = new RTCPeerConnection();
|
|
78185
|
+
mediaStream
|
|
78186
|
+
.getTracks()
|
|
78187
|
+
.forEach((track) => pc.addTrack(track, mediaStream));
|
|
78188
|
+
pc.ontrack = (event) => {
|
|
78189
|
+
setStream(event.streams[0]);
|
|
77395
78190
|
};
|
|
77396
|
-
|
|
78191
|
+
setPeerConnection(pc);
|
|
78192
|
+
setStream(mediaStream);
|
|
78193
|
+
setPermission(true);
|
|
78194
|
+
console.log('Microphone access granted, WebRTC connection established.');
|
|
77397
78195
|
}
|
|
77398
|
-
catch (
|
|
77399
|
-
|
|
78196
|
+
catch (err) {
|
|
78197
|
+
showErrorMessage(`The MediaRecorder API throws exception ${parse_stringifyError(err)}.`);
|
|
77400
78198
|
}
|
|
77401
78199
|
};
|
|
77402
|
-
//
|
|
77403
|
-
//
|
|
77404
|
-
|
|
77405
|
-
|
|
77406
|
-
|
|
77407
|
-
|
|
77408
|
-
|
|
77409
|
-
|
|
77410
|
-
|
|
77411
|
-
|
|
77412
|
-
|
|
77413
|
-
|
|
77414
|
-
|
|
77415
|
-
|
|
77416
|
-
|
|
77417
|
-
|
|
77418
|
-
|
|
77419
|
-
|
|
77420
|
-
|
|
77421
|
-
|
|
77422
|
-
|
|
77423
|
-
|
|
77424
|
-
|
|
77425
|
-
|
|
77426
|
-
|
|
77427
|
-
|
|
77428
|
-
|
|
77429
|
-
//
|
|
77430
|
-
//
|
|
77431
|
-
// const media = new MediaRecorder(stream, { mimeType: mimeContent });
|
|
77432
|
-
//
|
|
77433
|
-
// mediaRecorder.current = media;
|
|
77434
|
-
// mediaRecorder.current.start();
|
|
77435
|
-
//
|
|
77436
|
-
// const localAudioChunks: any[] = [];
|
|
77437
|
-
//
|
|
77438
|
-
// mediaRecorder.current.ondataavailable = (event) => {
|
|
77439
|
-
// if (typeof event.data === 'undefined') return;
|
|
77440
|
-
// if (event.data.size === 0) return;
|
|
77441
|
-
// localAudioChunks.push(event.data);
|
|
77442
|
-
// };
|
|
77443
|
-
//
|
|
77444
|
-
// setAudioChunks(localAudioChunks);
|
|
77445
|
-
// };
|
|
77446
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
78200
|
+
// Start recording using QBMediaRecorder
|
|
78201
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
78202
|
+
const startRecording = async () => {
|
|
78203
|
+
if (!stream)
|
|
78204
|
+
return;
|
|
78205
|
+
const mimeType = detectBrowserAndMimeType();
|
|
78206
|
+
console.log(`Selected MIME-type: ${mimeType}`);
|
|
78207
|
+
const recorder = new (src_default())({
|
|
78208
|
+
mimeType,
|
|
78209
|
+
timeslice: 1000, // Chunks of 1 second
|
|
78210
|
+
ignoreMutedMedia: true,
|
|
78211
|
+
onstart: () => console.log('Recording started'),
|
|
78212
|
+
onstop: (file) => {
|
|
78213
|
+
console.log('Final audio file:', file);
|
|
78214
|
+
setResultAudioBlob(file);
|
|
78215
|
+
setAudioChunks([]); // Clear recorded chunks
|
|
78216
|
+
},
|
|
78217
|
+
ondataavailable: (event) => {
|
|
78218
|
+
if (event.data.size > 0) {
|
|
78219
|
+
setAudioChunks((prev) => [...prev, event.data]);
|
|
78220
|
+
}
|
|
78221
|
+
},
|
|
78222
|
+
onerror: (error) => console.error('Recording error:', error),
|
|
78223
|
+
});
|
|
78224
|
+
mediaRecorder.current = recorder;
|
|
78225
|
+
recorder.start(stream);
|
|
78226
|
+
};
|
|
78227
|
+
// Stop recording
|
|
77447
78228
|
const stopRecording = () => {
|
|
77448
78229
|
if (!mediaRecorder.current)
|
|
77449
78230
|
return;
|
|
77450
78231
|
mediaRecorder.current.stop();
|
|
77451
|
-
|
|
77452
|
-
|
|
77453
|
-
|
|
77454
|
-
|
|
77455
|
-
|
|
77456
|
-
// const audioBlob = new Blob(audioChunks, { type: mimeContent }); // mimeType
|
|
77457
|
-
// const mp4Blob = new Blob(recordedChunks, { type: 'video/mp4' });
|
|
77458
|
-
// const audioBlob = new Blob(audioChunks, { type: 'video/mp4' }); // mimeType
|
|
77459
|
-
// const audioBlob = new Blob(audioChunks, { type: 'audio/mp4' }); // mimeType
|
|
77460
|
-
const audioBlob = new Blob(audioChunks, { type: 'audio/mp4' });
|
|
77461
|
-
setResultAudioBlob(audioBlob);
|
|
77462
|
-
setAudioChunks([]);
|
|
77463
|
-
//
|
|
77464
|
-
stream?.getAudioTracks().forEach((track) => {
|
|
77465
|
-
track.stop();
|
|
77466
|
-
});
|
|
77467
|
-
setPermission(false);
|
|
77468
|
-
//
|
|
77469
|
-
};
|
|
78232
|
+
// Stop WebRTC stream
|
|
78233
|
+
if (peerConnection) {
|
|
78234
|
+
peerConnection.close();
|
|
78235
|
+
setPeerConnection(null);
|
|
78236
|
+
}
|
|
77470
78237
|
};
|
|
77471
|
-
|
|
77472
|
-
|
|
77473
|
-
|
|
77474
|
-
b.lastModifiedDate = new Date();
|
|
77475
|
-
b.name = fileName;
|
|
77476
|
-
// Cast to a File() type
|
|
77477
|
-
const resultFile = theBlob;
|
|
77478
|
-
return resultFile;
|
|
78238
|
+
// Convert Blob to File
|
|
78239
|
+
const blobToFile = (blob, fileName) => {
|
|
78240
|
+
return new File([blob], fileName, { type: blob.type });
|
|
77479
78241
|
};
|
|
78242
|
+
// const blobToFile = (theBlob: Blob, fileName: string): File => {
|
|
78243
|
+
// const b: any = theBlob;
|
|
78244
|
+
//
|
|
78245
|
+
// // A Blob() is almost a File() - it's just missing the two properties below which we will add
|
|
78246
|
+
// b.lastModifiedDate = new Date();
|
|
78247
|
+
// b.name = fileName;
|
|
78248
|
+
//
|
|
78249
|
+
// // Cast to a File() type
|
|
78250
|
+
// const resultFile = theBlob as unknown as File;
|
|
78251
|
+
//
|
|
78252
|
+
// return resultFile;
|
|
78253
|
+
// };
|
|
77480
78254
|
function sendTextMessageActions(textToSend) {
|
|
77481
78255
|
if (isOnline) {
|
|
77482
78256
|
// closeReplyMessageFlowHandler
|
|
@@ -77847,7 +78621,6 @@ function useQuickBloxUIKit({ AIRephrase = undefined, AITranslate = undefined, AI
|
|
|
77847
78621
|
// 972
|
|
77848
78622
|
return {
|
|
77849
78623
|
constants: {
|
|
77850
|
-
mimeType,
|
|
77851
78624
|
messagePerPage,
|
|
77852
78625
|
maxFileSize,
|
|
77853
78626
|
maxWidthToResizing,
|
|
@@ -77882,7 +78655,6 @@ function useQuickBloxUIKit({ AIRephrase = undefined, AITranslate = undefined, AI
|
|
|
77882
78655
|
defaultAIRephraseWidget,
|
|
77883
78656
|
defaultAITranslateWidget,
|
|
77884
78657
|
defaultAIAssistWidget,
|
|
77885
|
-
mimeType,
|
|
77886
78658
|
messagePerPage,
|
|
77887
78659
|
maxTokensForAIRephrase,
|
|
77888
78660
|
rephraseTones,
|
|
@@ -78154,14 +78926,12 @@ const QuickBloxUIKitDesktopLayout = ({ theme, AITranslate, AIRephrase, AIAssist,
|
|
|
78154
78926
|
setNameDialogForSearch('');
|
|
78155
78927
|
} }), (0,jsx_runtime_.jsx)(new_chatreact, { className: classnames_default()('dialog-list-header__icons', {
|
|
78156
78928
|
'dialog-list-header__icons--disable': !isOnline,
|
|
78157
|
-
}), onClick: createDialogHandler })] }), renderFilter: showSearchDialogs ? ((0,jsx_runtime_.jsx)(ui_components_TextField_TextField, { className: "search-dialog-text-field", disabled: dialogsViewModel.loading, placeholder: "Search", icon: (0,jsx_runtime_.jsx)(searchreact, { className: "search-dialog-text-field__icon" }), value: nameDialogForSearch, onChange: setNameDialogForSearch })) : null, renderDialogList: (handleSelectDialog) =>
|
|
78158
|
-
|
|
78159
|
-
|
|
78160
|
-
|
|
78161
|
-
|
|
78162
|
-
|
|
78163
|
-
justifyContent: 'center',
|
|
78164
|
-
}, children: (0,jsx_runtime_.jsx)(Loader_Loader_Loader, { size: "md", className: "dialog-list__loader" }) })) : searchedDialogs.length > 0 ? (searchedDialogs.map((dlg, index) => renderDialogItem(dlg, index, handleSelectDialog))) : ((0,jsx_runtime_.jsx)(Placeholder_Placeholder_Placeholder, { icon: (0,jsx_runtime_.jsx)(chatreact, {}), text: "There are no dialogs.", className: "dialog-empty-chat-placeholder" })) })) : null, dialogMessagesView: showDialogMessages &&
|
|
78929
|
+
}), onClick: createDialogHandler })] }), renderFilter: showSearchDialogs ? ((0,jsx_runtime_.jsx)(ui_components_TextField_TextField, { className: "search-dialog-text-field", disabled: dialogsViewModel.loading, placeholder: "Search", icon: (0,jsx_runtime_.jsx)(searchreact, { className: "search-dialog-text-field__icon" }), value: nameDialogForSearch, onChange: setNameDialogForSearch })) : null, renderDialogList: (handleSelectDialog) => ((0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, { children: [dialogsViewModel?.loading && ((0,jsx_runtime_.jsx)("div", { className: "dialog-list__loader-container", style: {
|
|
78930
|
+
display: 'flex',
|
|
78931
|
+
flexDirection: 'row',
|
|
78932
|
+
alignItems: 'center',
|
|
78933
|
+
justifyContent: 'center',
|
|
78934
|
+
}, children: (0,jsx_runtime_.jsx)(Loader_Loader_Loader, { size: "md", className: "dialog-list__loader" }) })), searchedDialogs.length > 0 ? (searchedDialogs.map((dlg, index) => renderDialogItem(dlg, index, handleSelectDialog))) : ((0,jsx_runtime_.jsx)(Placeholder_Placeholder_Placeholder, { icon: (0,jsx_runtime_.jsx)(chatreact, {}), text: "There are no dialogs.", className: "dialog-empty-chat-placeholder" }))] })) })) : null, dialogMessagesView: showDialogMessages &&
|
|
78165
78935
|
selectedDialog &&
|
|
78166
78936
|
selectedDialog &&
|
|
78167
78937
|
dialogsViewModel.entity ? ((0,jsx_runtime_.jsx)(Views_Dialog_Dialog, { rootStyles: {
|