audio.seek() always returning false

I’m working on a digital book and would like to have audio available for a “read it to me” option. Additionally, the user should be able to click on any word and have just that word read to them. My thought was to have a single audio track per page and to use audio.seek() to go directly to that portion of the track where the specific word is. The problem I’m having is that audio.seek() is always returning false for me and therefore is not moving to the correct point in the audio, but rather is simply playing the first X ms of audio no matter what.

Here’s my test code. The audio track is about 5 seconds long. I would expect that this would play one second of audio starting 1 second into the track. It plays the 1 second, but it always starts from the beginning.

audioHandle = audio.loadSound("audio/test.mp3")   
local mychannel = audio.play(audioHandle, {channel = 2, duration = 1000})  
local seekResult = audio.seek(1000, {channel = mychannel})  
print ("seek result: ")  
print (seekResult)  

I’ve tried pausing then seeking then resuming, but it doesn’t change the end result that seekResult is always false, and the audio always plays from the beginning.

Any help in understanding what I’m doing wrong and how to correct it is greatly appreciated.

Thanks,
-Glen [import]uid: 46321 topic_id: 12504 reply_id: 312504[/import]

It seems to work if I use audio.loadStream() instead of audio.loadSound() and use the following code:

audioHandle = audio.loadStream("audio/test.mp3")  
local mychannel = audio.play(audioHandle, {channel = 2, duration=1})  
audio.stop()  
local seekResult = audio.seek(1000, audioHandle)  
print ("seek result: ")  
print (seekResult)  
audio.play(audioHandle, {channel = mychannel, duration = 1000})  

I suppose I’m ok with this, but would prefer to use audio.loadSound() if possible for performance consideration.

If anyone knows how to do this using audio.loadSound(), please post a reply here.

Thanks,
-Glen [import]uid: 46321 topic_id: 12504 reply_id: 45712[/import]

Hey Glen,

Have you filed a bug for this? I’m having the same issue on build 621. I can’t seek with audio.loadSound but it works for audio.loadStream. [import]uid: 27183 topic_id: 12504 reply_id: 56971[/import]

Seek the Channel instead of the handle? [import]uid: 84637 topic_id: 12504 reply_id: 56977[/import]

Yeah it says so under the remarks, but doesn’t work.

http://developer.anscamobile.com/reference/index/audioseek
Audio loaded with audio.loadSound() may only seek using the channel parameter. [import]uid: 27183 topic_id: 12504 reply_id: 56980[/import]

It sounds like a bug. audio.seek on loadSound should work on channels, paused or not.

Would you submit a bug report with a simple test case so we don’t lose track of this?
[import]uid: 7563 topic_id: 12504 reply_id: 57009[/import]

Bug report submitted. (Case 8247) audio.seek does not work with channel with audio.loadSound
X [import]uid: 27183 topic_id: 12504 reply_id: 57112[/import]

I can’t seem to find case 8247 in the Corona Bug Base. All mentions of “seek() is broken” have been closed as well and I can’t open them to view their descriptions.

Does this mean this has been fixed in the daily builds? [import]uid: 52771 topic_id: 12504 reply_id: 69050[/import]

Yes. This was fixed. [import]uid: 7563 topic_id: 12504 reply_id: 69051[/import]