sceyt-chat-react-uikit 1.9.0-beta.1 → 1.9.0-beta.2

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/index.js CHANGED
@@ -52613,6 +52613,10 @@ var AudioRecord = function AudioRecord(_ref) {
52613
52613
  if (recording) {
52614
52614
  stopRecording(true, id, false, recorder);
52615
52615
  } else if (currentRecordedFile) {
52616
+ if (!currentRecordedFile.dur) {
52617
+ cancelRecording();
52618
+ return Promise.resolve();
52619
+ }
52616
52620
  removeAudioRecordingFromMap(id);
52617
52621
  setRecordedFile(null);
52618
52622
  setPlayAudio(false);
@@ -52639,7 +52643,8 @@ var AudioRecord = function AudioRecord(_ref) {
52639
52643
  var init = function init() {
52640
52644
  obj.canvas = document.getElementById("waveform-" + id);
52641
52645
  obj.ctx = obj.canvas.getContext('2d');
52642
- obj.width = 360;
52646
+ var renderedWidth = Math.round(obj.canvas.getBoundingClientRect().width);
52647
+ obj.width = renderedWidth > 0 ? renderedWidth : 300;
52643
52648
  obj.height = 28;
52644
52649
  obj.canvas.width = obj.width;
52645
52650
  obj.canvas.height = obj.height;
@@ -52704,8 +52709,10 @@ var AudioRecord = function AudioRecord(_ref) {
52704
52709
  streamSource.connect(obj.analyser);
52705
52710
  obj.analyser.fftSize = 512;
52706
52711
  obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
52707
- init();
52708
- _loop();
52712
+ requestAnimationFrame(function () {
52713
+ init();
52714
+ _loop();
52715
+ });
52709
52716
  };
52710
52717
  soundAllowed(stream);
52711
52718
  })["catch"](function (e) {
@@ -52791,6 +52798,15 @@ var AudioRecord = function AudioRecord(_ref) {
52791
52798
  var objectUrl = URL.createObjectURL(blob);
52792
52799
  var durationInt = Math.round(audioBuffer.duration);
52793
52800
  if (send) {
52801
+ if (!durationInt) {
52802
+ if (objectUrl.startsWith('blob:')) {
52803
+ URL.revokeObjectURL(objectUrl);
52804
+ }
52805
+ setShowRecording(false);
52806
+ removeAudioRecordingFromMap(id);
52807
+ dispatch(setChannelDraftMessageIsRemovedAC(id));
52808
+ return;
52809
+ }
52794
52810
  sendRecordedFile({
52795
52811
  file: file,
52796
52812
  objectUrl: objectUrl,
@@ -52955,7 +52971,6 @@ var AudioRecord = function AudioRecord(_ref) {
52955
52971
  setCurrentTimeSeconds(0);
52956
52972
  }
52957
52973
  return function () {
52958
- handleStopRecording();
52959
52974
  setCurrentTime(0);
52960
52975
  setCurrentTimeSeconds(0);
52961
52976
  };
package/index.modern.js CHANGED
@@ -52593,6 +52593,10 @@ var AudioRecord = function AudioRecord(_ref) {
52593
52593
  if (recording) {
52594
52594
  stopRecording(true, id, false, recorder);
52595
52595
  } else if (currentRecordedFile) {
52596
+ if (!currentRecordedFile.dur) {
52597
+ cancelRecording();
52598
+ return Promise.resolve();
52599
+ }
52596
52600
  removeAudioRecordingFromMap(id);
52597
52601
  setRecordedFile(null);
52598
52602
  setPlayAudio(false);
@@ -52619,7 +52623,8 @@ var AudioRecord = function AudioRecord(_ref) {
52619
52623
  var init = function init() {
52620
52624
  obj.canvas = document.getElementById("waveform-" + id);
52621
52625
  obj.ctx = obj.canvas.getContext('2d');
52622
- obj.width = 360;
52626
+ var renderedWidth = Math.round(obj.canvas.getBoundingClientRect().width);
52627
+ obj.width = renderedWidth > 0 ? renderedWidth : 300;
52623
52628
  obj.height = 28;
52624
52629
  obj.canvas.width = obj.width;
52625
52630
  obj.canvas.height = obj.height;
@@ -52684,8 +52689,10 @@ var AudioRecord = function AudioRecord(_ref) {
52684
52689
  streamSource.connect(obj.analyser);
52685
52690
  obj.analyser.fftSize = 512;
52686
52691
  obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
52687
- init();
52688
- _loop();
52692
+ requestAnimationFrame(function () {
52693
+ init();
52694
+ _loop();
52695
+ });
52689
52696
  };
52690
52697
  soundAllowed(stream);
52691
52698
  })["catch"](function (e) {
@@ -52771,6 +52778,15 @@ var AudioRecord = function AudioRecord(_ref) {
52771
52778
  var objectUrl = URL.createObjectURL(blob);
52772
52779
  var durationInt = Math.round(audioBuffer.duration);
52773
52780
  if (send) {
52781
+ if (!durationInt) {
52782
+ if (objectUrl.startsWith('blob:')) {
52783
+ URL.revokeObjectURL(objectUrl);
52784
+ }
52785
+ setShowRecording(false);
52786
+ removeAudioRecordingFromMap(id);
52787
+ dispatch(setChannelDraftMessageIsRemovedAC(id));
52788
+ return;
52789
+ }
52774
52790
  sendRecordedFile({
52775
52791
  file: file,
52776
52792
  objectUrl: objectUrl,
@@ -52935,7 +52951,6 @@ var AudioRecord = function AudioRecord(_ref) {
52935
52951
  setCurrentTimeSeconds(0);
52936
52952
  }
52937
52953
  return function () {
52938
- handleStopRecording();
52939
52954
  setCurrentTime(0);
52940
52955
  setCurrentTimeSeconds(0);
52941
52956
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.9.0-beta.1",
3
+ "version": "1.9.0-beta.2",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",