@superinterface/react 5.3.0-beta.13 → 5.3.0-beta.15

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/index.js CHANGED
@@ -47968,9 +47968,11 @@ var useMessageAudio = function(_ref) {
47968
47968
  checkForCompletion
47969
47969
  ]);
47970
47970
  useEffect10(function() {
47971
- if (isPlaying) return;
47971
+ var allowParallel = Boolean(providedPlaySegments);
47972
+ if (!allowParallel && isPlaying) return;
47972
47973
  if (pickLockRef.current) return;
47973
47974
  if (audioQueue.length === 0) return;
47975
+ if (!allowParallel && audioPlayer.playing) return;
47974
47976
  var candidate = null;
47975
47977
  for(var i_3 = 0; i_3 < audioQueue.length; i_3++){
47976
47978
  var msg = audioQueue[i_3];
@@ -47997,95 +47999,64 @@ var useMessageAudio = function(_ref) {
47997
47999
  }) : m_14;
47998
48000
  });
47999
48001
  });
48000
- var runPlayback = /* @__PURE__ */ function() {
48001
- var _ref0 = _asyncToGenerator11(function() {
48002
- var nextIndex_0, error;
48003
- return _ts_generator(this, function(_state) {
48004
- switch(_state.label){
48005
- case 0:
48006
- nextIndex_0 = candidate.startIndex;
48007
- _state.label = 1;
48008
- case 1:
48009
- _state.trys.push([
48010
- 1,
48011
- 3,
48012
- 4,
48013
- 5
48014
- ]);
48015
- return [
48016
- 4,
48017
- playSegmentsImpl({
48018
- segments: candidate.segments,
48019
- startIndex: candidate.startIndex,
48020
- message: candidate.message,
48021
- play: function() {
48022
- var _play = _asyncToGenerator11(function(segment_0) {
48023
- return _ts_generator(this, function(_state) {
48024
- switch(_state.label){
48025
- case 0:
48026
- activeSegmentsRef.current += 1;
48027
- nextIndex_0 += 1;
48028
- currentSegmentRef.current = {
48029
- messageId: candidate.messageId,
48030
- nextIndex: nextIndex_0
48031
- };
48032
- return [
48033
- 4,
48034
- playInternal(segment_0, {
48035
- onPlay: function() {},
48036
- onStop: function() {
48037
- return handleStop(candidate.messageId);
48038
- },
48039
- onEnd: function() {
48040
- return handleSegmentEnd();
48041
- }
48042
- })
48043
- ];
48044
- case 1:
48045
- _state.sent();
48046
- return [
48047
- 2
48048
- ];
48002
+ var runPlayback = function() {
48003
+ var nextIndex_0 = candidate.startIndex;
48004
+ var launch = function() {
48005
+ return playSegmentsImpl({
48006
+ segments: candidate.segments,
48007
+ startIndex: candidate.startIndex,
48008
+ message: candidate.message,
48009
+ play: function() {
48010
+ var _play = _asyncToGenerator11(function(segment_0) {
48011
+ return _ts_generator(this, function(_state) {
48012
+ switch(_state.label){
48013
+ case 0:
48014
+ activeSegmentsRef.current += 1;
48015
+ nextIndex_0 += 1;
48016
+ currentSegmentRef.current = {
48017
+ messageId: candidate.messageId,
48018
+ nextIndex: nextIndex_0
48019
+ };
48020
+ return [
48021
+ 4,
48022
+ playInternal(segment_0, {
48023
+ onPlay: function() {},
48024
+ onStop: function() {
48025
+ return handleStop(candidate.messageId);
48026
+ },
48027
+ onEnd: function() {
48028
+ return handleSegmentEnd();
48049
48029
  }
48050
- });
48051
- });
48052
- function play(_x6) {
48053
- return _play.apply(this, arguments);
48054
- }
48055
- return play;
48056
- }()
48057
- })
48058
- ];
48059
- case 2:
48060
- _state.sent();
48061
- return [
48062
- 3,
48063
- 5
48064
- ];
48065
- case 3:
48066
- error = _state.sent();
48067
- handleStop(candidate.messageId);
48068
- console.error(error);
48069
- return [
48070
- 3,
48071
- 5
48072
- ];
48073
- case 4:
48074
- checkForCompletion();
48075
- return [
48076
- 7
48077
- ];
48078
- case 5:
48079
- return [
48080
- 2
48081
- ];
48082
- }
48030
+ })
48031
+ ];
48032
+ case 1:
48033
+ _state.sent();
48034
+ return [
48035
+ 2
48036
+ ];
48037
+ }
48038
+ });
48039
+ });
48040
+ function play(_x6) {
48041
+ return _play.apply(this, arguments);
48042
+ }
48043
+ return play;
48044
+ }()
48083
48045
  });
48084
- });
48085
- return function runPlayback2() {
48086
- return _ref0.apply(this, arguments);
48087
48046
  };
48088
- }();
48047
+ try {
48048
+ Promise.resolve(launch()).catch(function(error_0) {
48049
+ handleStop(candidate.messageId);
48050
+ console.error(error_0);
48051
+ }).finally(function() {
48052
+ checkForCompletion();
48053
+ });
48054
+ } catch (error) {
48055
+ handleStop(candidate.messageId);
48056
+ console.error(error);
48057
+ checkForCompletion();
48058
+ }
48059
+ };
48089
48060
  runPlayback();
48090
48061
  }, [
48091
48062
  audioQueue,
@@ -48094,7 +48065,9 @@ var useMessageAudio = function(_ref) {
48094
48065
  playInternal,
48095
48066
  handleStop,
48096
48067
  handleSegmentEnd,
48097
- checkForCompletion
48068
+ checkForCompletion,
48069
+ providedPlaySegments,
48070
+ audioPlayer.playing
48098
48071
  ]);
48099
48072
  useEffect10(function() {
48100
48073
  if (isHtmlAudioSupported) {