This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
🚀 Performance, usability & playback improvements #27
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added separate Method class to get arguments & return values through method channels easily. - Now using std::map instead of std::vector for handling mutiple players.
- Audio Devices class now has following static methods to deal with playback. - getAll - getDefault - getAllMap
- Now plugin uses miniaudio_engine. - Added AudioPlayers class with single method to create new or get existing player. - Using std::map instead of std::vector to create a new player for any particular ID. - General improvements to structure of code. - Instanciating ma_resource_manager with MA_DATA_SOURCE_FLAG_STREAM flag.
- Fixed randomly occuring segmentation fault. - No longer async method will be called from Dart's class constructor.
- Playback now stops once the track is finished & informs Dart side code. - Now pause event is also recognised inside the broadcast stream. (Might get improved in future) - Now stop method no longer, causes termination on false assertion. - Added isStopped attribute to Audio objects to indicate if a file is loaded.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains major rewrite of the plugin to improve performance, add new features & more control on playback of audio.
Plugin Changes:
stream
(a broadcast stream) insideAudioPlayer
. This was a great problem in earlier version as one always needs to trigger UI updates whenever playback progresses, ends etc.audio.isCompleted
storesbool
if an audio has ended, same can be accessed fromstream
.Queue
class to play audio files sequentially, without having to deal with things likeaudio.isCompleted
etc. manually.Queue
or repeat playback etc.id
while creating new instance ofAudioPlayer
, this was a big problem earlier as newid
had to be consecutive to earlier one.AudioPlayer
even if you make new constructor, by providing sameid
.AudioPlayer
usingload
method.AudioSource
class has two static methodsAudioSource.fromFile
to load an audio file.AudioSource.fromAsset
to load an audio asset.Audio
object, inside the AudioPlayer class & contains following fields to get information about current playback.file
: Current loadedFile
.isPlaying
: Whether file is playing.isCompleted
: Whether file is ended playing.stop
method is called &AudioPlayer
is reverted to initial configuration.isStopped
: Whether file is loaded.position
: Position of current playback inDuration
.duration
: Duration of current file inDuration
.AudioPlayer
no longer calls async methods, which could result in false assertions.Native Code Changes:
ma_resource_manager
is used fromminiaudio_engine
withMA_DATA_SOURCE_FLAG_STREAM
flag.AudioDevices
.flutter_types.hpp
improves code readability.Progress on Platforms
Bringing these changes to Windows will take barely few hours.