feat(windows): Add millisecond level precision when seeking#1548
Conversation
|
I would rather prefer to use double precision |
That sounds like a great improvement to code readability! |
|
@SNNafi I'm not allowed to make edits to your Pull request, if you wish so, you have to enable that option on the right of your Pull request. |
|
@Gustl22, It seems GitHub doesn't allow "Allow edits by maintainers" option, if PR is given from an org account. :( |
|
@Gustl22 maybe we could just merge this to another branch than |
Description
This pull request addresses the issue related to audio seeking precision in the Audioplayers plugin for Windows. The problem is currently limited to seconds instead of milliseconds. The proposed changes modify the code to support seeking with millisecond precision, allowing users to accurately seek to specific points within an audio file.
Changes Made:
File:
MediaEngineWrapper.cppModified the
SeekTofunction:Changed the parameter type from
uint64_ttodoublefor thetimeStampparameter.Updated the calculation of
timestampInSecondsto converttimeStampfrom milliseconds to seconds (timeStamp / 1000.0).Changed the call to
m_mediaEngine->SetCurrentTimeto use the updatedtimestampInSecondsvalue.Modified the
GetMediaTimefunction:Removed the unnecessary assignment of
currentTimein milliseconds.Updated the calculation of
currentTimeInSecondsto convert the current time from seconds to milliseconds(currentTimeInSeconds * 1000.0).Return only
currentTimeInHnsinstead of bothcurrentTimeInHnsandcurrentTime.Modified the
GetDuration1 function: Updated the calculation ofdurationInSecondsto convert the duration from seconds to milliseconds(durationInSeconds * 1000.0). Returnduration`.File:
audio_player.cppModified the
OnTimeUpdate()method:Updated the
flutter::EncodableValuefor thevaluefield to directly use(int64_t)m_mediaEngineWrapper->GetMediaTime()instead of dividing by 10000.Modified the
OnDurationUpdate()method:Updated the
flutter::EncodableValuefor thevaluefield to directly use(int64_t)m_mediaEngineWrapper->GetDuration()instead of dividing by 10000.Modified the
SeekTofunction in the AudioPlayer class to accept a double parameter instead ofint64_t.File:
audio_player.hUpdated the function declaration of
SeekToin the AudioPlayer class to accept adoubleparameter instead ofint64_t.File:
audioplayers_windows_plugin.cppModified the
seekmethod to usedoublefor the position argument and directly pass it toplayer->SeekTo.Checklist
fix:,feat:,docs:,chore:etc).///, where necessary.Breaking Change
Related Issues
#1547