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.

1
2
3
4
5
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)

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

1
2
3
4
5
6
7
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})
views:1780 update:2011/9/28 9:01:40
corona forums © 2003-2011