-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't play recorded track #35
Comments
At the very least the finally block is a problem as it will execute even if the exception is thrown |
Removing the finally block doesn't solve the issue. The problem ultimately is why is track null? |
Can you provide a more complete example.
…On Wed, 2 Sep 2020, 11:41 pm mtkgeek, ***@***.***> wrote:
Removing the finally block doesn't solve the issue. The problem ultimately
for me is why is track null
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#35 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG32ODCPITVNLUZIRBAYADSDZDO7ANCNFSM4QPRLMJA>
.
|
I have a theory the problem is in QuickPlay._play try changing it to the following (note the extra awaits) Future<void> _play(double volume) async {
await _player.setVolume(volume);
await _player.audioFocus(AudioFocus.hushOthersWithResume);
_player.onStopped = ({wasUser}) {
_player.release();
if (_onStopped != null) _onStopped();
};
return _player.play(_track);
} It feels like its a race condition at the android level. We are a week or so from being able to push a new release as we are in the middle of converting the objective-c code to swift. |
I've pushed the above code to git. |
I've pushed a possible fix to github.
…On Wed, 16 Sep 2020 at 18:30, IWANTANELEPHANT ***@***.***> wrote:
Hi,
I have the same problem. I record an acc file, save it on the device, and
try to play it back:
Record:
new File(path).create(recursive: true).then((File file) {
var track =
Track.fromFile(path, mediaFormat: WellKnownMediaFormats.adtsAac);
recorder.record(track);
});
Play (after user interaction):
var track = Track.fromFile(localPath);
if (track != null) {
QuickPlay.fromTrack(track);
} else {
print('track is null');
}
I validate that track is not null before passing it to QuickPlay.
Resulting in the same error:
E/flutter (32754): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled
Exception: 'package:sounds/src/sound_player.dart': Failed assertion: line
309 pos 12: 'track != null': is not true.
E/flutter (32754): #0 _AssertionError._doThrowNew
(dart:core-patch/errors_patch.dart:46:39)
E/flutter (32754): #1 <#1>
_AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter (32754): #2 <#2>
SoundPlayer.play (package:sounds/src/sound_player.dart:309:12)
E/flutter (32754): #3 <#3>
QuickPlay._play (package:sounds/src/quick_play.dart:159:20)
E/flutter (32754): #4 <#4> new
QuickPlay._internal (package:sounds/src/quick_play.dart:75:5)
E/flutter (32754): #5 <#5> new
QuickPlay.fromTrack (package:sounds/src/quick_play.dart:62:15)
E/flutter (32754): #6 <#6>
_ImageGridState.play (package:scrum_utils/scrum_gallery.dart:137:17)
E/flutter (32754): #7 <#7>
_ImageGridState.showCard.. (package:scrum_utils/scrum_gallery.dart:221:31)
E/flutter (32754): #8 <#8>
_InkResponseState._handleTap
(package:flutter/src/material/ink_well.dart:992:19)
E/flutter (32754): #9 <#9>
_InkResponseState.build.
(package:flutter/src/material/ink_well.dart:1098:38)
E/flutter (32754): #10 <#10>
GestureRecognizer.invokeCallback
(package:flutter/src/gestures/recognizer.dart:184:24)
E/flutter (32754): #11 <#11>
TapGestureRecognizer.handleTapUp
(package:flutter/src/gestures/tap.dart:524:11)
E/flutter (32754): #12 <#12>
BaseTapGestureRecognizer._checkUp
(package:flutter/src/gestures/tap.dart:284:5)
E/flutter (32754): #13 <#13>
BaseTapGestureRecognizer.handlePrimaryPointer
(package:flutter/src/gestures/tap.dart:219:7)
E/flutter (32754): #14 <#14>
PrimaryPointerGestureRecognizer.handleEvent
(package:flutter/src/gestures/recognizer.dart:477:9)
E/flutter (32754): #15 <#15>
PointerRouter._dispatch
(package:flutter/src/gestures/pointer_router.dart:78:12)
E/flutter (32754): #16 <#16>
PointerRouter._dispatchEventToRoutes.
(package:flutter/src/gestures/pointer_router.dart:124:9)
E/flutter (32754): #17 <#17>
_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
E/flutter (32754): #18 <#18>
PointerRouter._dispatchEventToRoutes
(package:flutter/src/gestures/pointer_router.dart:122:18)
E/flutter (32754): #19 <#19>
PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:108:7)
E/flutter (32754): #20 <#20>
GestureBinding.handleEvent
(package:flutter/src/gestures/binding.dart:220:19)
E/flutter (32754): #21 <#21>
GestureBinding.dispatchEvent
(package:flutter/src/gestures/binding.dart:200:22)
E/flutter (32754): #22 <#22>
GestureBinding._handlePointerEvent
(package:flutter/src/gestures/binding.dart:158:7)
E/flutter (32754): #23 <#23>
GestureBinding._flushPointerEventQueue
(package:flutter/src/gestures/binding.dart:104:7)
E/flutter (32754): #24 <#24>
GestureBinding._handlePointerDataPacket
(package:flutter/src/gestures/binding.dart:88:7)
E/flutter (32754): #25 <#25>
_rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (32754): #26 <#26>
_CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (32754): #27 <#27>
_CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (32754): #28 <#28>
_invoke1 (dart:ui/hooks.dart:267:10)
E/flutter (32754): #29 <#29>
_dispatchPointerDataPacket (dart:ui/hooks.dart:176:5)
E/flutter (32754):
E/flutter (32754): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled
Exception: 'package:sounds/src/sound_player.dart': Failed assertion: line
309 pos 12: 'track != null': is not true.
E/flutter (32754): #0 _AssertionError._doThrowNew
(dart:core-patch/errors_patch.dart:46:39)
E/flutter (32754): #1 <#1>
_AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter (32754): #2 <#2>
SoundPlayer.play (package:sounds/src/sound_player.dart:309:12)
E/flutter (32754): #3 <#3>
QuickPlay._play (package:sounds/src/quick_play.dart:159:20)
E/flutter (32754): #4 <#4> new
QuickPlay._internal (package:sounds/src/quick_play.dart:75:5)
E/flutter (32754): #5 <#5> new
QuickPlay.fromFile (package:sounds/src/quick_play.dart:101:15)
E/flutter (32754): #6 <#6>
_ImageGridState.play (package:scrum_utils/scrum_gallery.dart:139:17)
E/flutter (32754): #7 <#7>
_ImageGridState.showCard.. (package:scrum_utils/scrum_gallery.dart:221:31)
E/flutter (32754): #8 <#8>
_InkResponseState._handleTap
(package:flutter/src/material/ink_well.dart:992:19)
E/flutter (32754): #9 <#9>
_InkResponseState.build.
(package:flutter/src/material/ink_well.dart:1098:38)
E/flutter (32754): #10 <#10>
GestureRecognizer.invokeCallback
(package:flutter/src/gestures/recognizer.dart:184:24)
E/flutter (32754): #11 <#11>
TapGestureRecognizer.handleTapUp
(package:flutter/src/gestures/tap.dart:524:11)
E/flutter (32754): #12 <#12>
BaseTapGestureRecognizer._checkUp
(package:flutter/src/gestures/tap.dart:284:5)
E/flutter (32754): #13 <#13>
BaseTapGestureRecognizer.handlePrimaryPointer
(package:flutter/src/gestures/tap.dart:219:7)
E/flutter (32754): #14 <#14>
PrimaryPointerGestureRecognizer.handleEvent
(package:flutter/src/gestures/recognizer.dart:477:9)
E/flutter (32754): #15 <#15>
PointerRouter._dispatch
(package:flutter/src/gestures/pointer_router.dart:78:12)
E/flutter (32754): #16 <#16>
PointerRouter._dispatchEventToRoutes.
(package:flutter/src/gestures/pointer_router.dart:124:9)
E/flutter (32754): #17 <#17>
_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
E/flutter (32754): #18 <#18>
PointerRouter._dispatchEventToRoutes
(package:flutter/src/gestures/pointer_router.dart:122:18)
E/flutter (32754): #19 <#19>
PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:108:7)
E/flutter (32754): #20 <#20>
GestureBinding.handleEvent
(package:flutter/src/gestures/binding.dart:220:19)
E/flutter (32754): #21 <#21>
GestureBinding.dispatchEvent
(package:flutter/src/gestures/binding.dart:200:22)
E/flutter (32754): #22 <#22>
GestureBinding._handlePointerEvent
(package:flutter/src/gestures/binding.dart:158:7)
E/flutter (32754): #23 <#23>
GestureBinding._flushPointerEventQueue
(package:flutter/src/gestures/binding.dart:104:7)
E/flutter (32754): #24 <#24>
GestureBinding._handlePointerDataPacket
(package:flutter/src/gestures/binding.dart:88:7)
E/flutter (32754): #25 <#25>
_rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (32754): #26 <#26>
_CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (32754): #27 <#27>
_CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (32754): #28 <#28>
_invoke1 (dart:ui/hooks.dart:267:10)
E/flutter (32754): #29 <#29>
_dispatchPointerDataPacket (dart:ui/hooks.dart:176:5)
E/flutter (32754):
E/flutter (32754): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled
Exception: PlatformException(ERR_PLAYER_IS_NULL, setVolume(),
ERR_PLAYER_IS_NULL)
E/flutter (32754): #0 StandardMethodCodec.decodeEnvelope
(package:flutter/src/services/message_codecs.dart:572:7)
E/flutter (32754): #1 <#1>
MethodChannel._invokeMethod
(package:flutter/src/services/platform_channel.dart:161:18)
E/flutter (32754):
E/flutter (32754): #2 <#2>
MethodChannel.invokeMethod
(package:flutter/src/services/platform_channel.dart:334:12)
E/flutter (32754): #3 <#3>
BasePlugin.invokeMethod (package:sounds/src/plugins/base_plugin.dart:112:27)
E/flutter (32754): #4 <#4>
PlayerBasePlugin.setVolume
(package:sounds/src/plugins/player_base_plugin.dart:123:11)
E/flutter (32754): #5 <#5>
SoundPlayer.setVolume. (package:sounds/src/sound_player.dart:450:21)
E/flutter (32754): #6 <#6>
SoundPlayer._initializeAndRun. (package:sounds/src/sound_player.dart:241:19)
E/flutter (32754): #7 <#7>
_rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (32754): #8 <#8>
_CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (32754): #9 <#9>
_FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter (32754): #10 <#10>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
E/flutter (32754): #11 <#11>
Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter (32754): #12 <#12>
Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter (32754): #13 <#13>
Future.timeout. (dart:async/future_impl.dart:797:16)
E/flutter (32754): #14 <#14>
_rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (32754): #15 <#15>
_CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (32754): #16 <#16>
_FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter (32754): #17 <#17>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
E/flutter (32754): #18 <#18>
Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter (32754): #19 <#19>
Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter (32754): #20 <#20>
Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7)
E/flutter (32754): #21 <#21>
_rootRun (dart:async/zone.dart:1190:13)
E/flutter (32754): #22 <#22>
_CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (32754): #23 <#23>
_CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (32754): #24 <#24>
_CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
E/flutter (32754): #25 <#25>
_microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (32754): #26 <#26>
_startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (32754):
E/flutter (32754): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled
Exception: PlatformException(ERR_PLAYER_IS_NULL, setVolume(),
ERR_PLAYER_IS_NULL)
E/flutter (32754): #0 StandardMethodCodec.decodeEnvelope
(package:flutter/src/services/message_codecs.dart:572:7)
E/flutter (32754): #1 <#1>
MethodChannel._invokeMethod
(package:flutter/src/services/platform_channel.dart:161:18)
E/flutter (32754):
E/flutter (32754): #2 <#2>
MethodChannel.invokeMethod
(package:flutter/src/services/platform_channel.dart:334:12)
E/flutter (32754): #3 <#3>
BasePlugin.invokeMethod (package:sounds/src/plugins/base_plugin.dart:112:27)
E/flutter (32754): #4 <#4>
PlayerBasePlugin.setVolume
(package:sounds/src/plugins/player_base_plugin.dart:123:11)
E/flutter (32754): #5 <#5>
SoundPlayer.setVolume. (package:sounds/src/sound_player.dart:450:21)
E/flutter (32754): #6 <#6>
SoundPlayer._initializeAndRun. (package:sounds/src/sound_player.dart:241:19)
E/flutter (32754): #7 <#7>
_rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (32754): #8 <#8>
_CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (32754): #9 <#9>
_FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter (32754): #10 <#10>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
E/flutter (32754): #11 <#11>
Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter (32754): #12 <#12>
Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter (32754): #13 <#13>
Future.timeout. (dart:async/future_impl.dart:797:16)
E/flutter (32754): #14 <#14>
_rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (32754): #15 <#15>
_CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (32754): #16 <#16>
_FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter (32754): #17 <#17>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:696:45)
E/flutter (32754): #18 <#18>
Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter (32754): #19 <#19>
Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter (32754): #20 <#20>
Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7)
E/flutter (32754): #21 <#21>
_rootRun (dart:async/zone.dart:1190:13)
E/flutter (32754): #22 <#22>
_CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (32754): #23 <#23>
_CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (32754): #24 <#24>
_CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
E/flutter (32754): #25 <#25>
_microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (32754): #26 <#26>
_startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (32754):
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#35 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG32OAZG2FQ2G5MPHSBBK3SGBZTBANCNFSM4QPRLMJA>
.
|
Hi @bsutton , So, Quick fix would be to only pass Track object into You can try the code below to verify my solution.
Cheers mate. |
i keep getting the
Failed assertion: line 309 pos 12: 'track != null': is not true.
error whenever i try to play my recorded track usingQuickplay.fromTrack()
.Here's a snippet of my code
After recording with the above method then i call the method below
Note: All methods are in the same class.
The text was updated successfully, but these errors were encountered: