Source language: Translate to:

stop/pause one audio while other plays

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

stop/pause one audio while other plays

Postby BikerBen » Mon Dec 04, 2006 5:54 pm

In my ebook, I have background music playing but one other audio file that the user can activate. While the user-activated one plays, I want to pause or stop the background audio and restart it after the user-activated one finishes. Can someone help me with the coding?
User avatar
BikerBen
 
Posts: 10
Joined: Thu Apr 06, 2006 6:17 pm
Location: Indiana, USA

Postby Gaev » Mon Dec 04, 2006 6:21 pm

BikerBen:

I don't know of any functions in the base NeoBook product to ...

a) detect when an audio file has finished playing

b) restart a stopped audio file from its previously stopped/paused position


Have you looked at the NeoBookDX plugin from NeoSoftware ? ... with it, you will be able to perform the above functions.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby BikerBen » Mon Dec 04, 2006 7:31 pm

Gaev,

I have downloaded the plug-in and know how to pause the first audio track and play the second but I don't know how to code the detection and restart.
User avatar
BikerBen
 
Posts: 10
Joined: Thu Apr 06, 2006 6:17 pm
Location: Indiana, USA

Postby Gaev » Tue Dec 05, 2006 4:46 am

BikerBen:
... I don't know how to code the detection ...
In order to detect when an audio file has finished playing, you can specify a SubRoutine to be invoked when this condition arises ... in the dxCreate command ...
Code: Select all
dxCreate "rectangle" "player id variable" "yourSubRoutineNameHere"
... from the Help file for this command ...
Code: Select all
subroutine (optional)

The name of a subroutine from your publication's Subroutine Action. The subroutine specified here will be automatically executed if the media player plays all the way to the end of a file. Subroutines are entered from the Actions page of NeoBook's Book Properties screen. Leave this parameter blank if you do not wish to use a subroutine.
... so in your application, you specify a SubRoutine for the user activated audio file
... and restart
... in the above mentioned SubRoutine, you re-start the background audio ... using the dxPlayFromTo command ... in order to know where to restart from ... in the button that the user clicks to activate the page specific audio ... after you pause the background file, save its current position from the reserved variable ... [PlayerID.Position] or [PlayerID.PositionHMS].
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron