google / flutter.plugins

BSD 3-Clause "New" or "Revised" License
117 stars 55 forks source link

Problem with Duration #48

Closed csacchetti closed 3 years ago

csacchetti commented 4 years ago

I found a problem with the value that Duration Function provides. I noticed the error when I implemented the function in the BlockScreen notification window. The system slider (of iOS) did not move properly and terminated or before or after. I tried to compare the result that the Duration function provided and the actual length of the file and did not actually match.

I init the variable double _audioDurationSeconds;

I load the file _audio = Audio.load( 'assets/audios/${myVarList[indexVar][indexGo]}', onComplete: () => setState(() => myComplete()), onDuration: (double durationSeconds) => setState(() => _audioDurationSeconds = durationSeconds), playInBackground: true, );

I set metaData AudioSystem.instance.setMetadata(AudioMetadata( title: "${interfaceTexts.itInterfaceTexts["myText"]} ${resulVarList[0]}", artist: myListTextMystery[indexVar][0] + " - " + myLabel, durationSeconds: _audioDurationSeconds, artBytes: imageBytes));

The result of _audioDurationSeconds don't match with the real duration of file (I see in the info windows) of the file. In each case a second less, in other a second more...