Source language: Translate to:

Stop Media

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Stop Media

Postby Jim Brammer » Thu Feb 07, 2002 6:19 pm

Stop Media
I have a program that plays a midi file, and at the conclusion of playing the midi file needs to move on to the next page.

At the same time, I would like to give the user the ability to "Cancel" and leave the page immediately.

When I use the PlaySoundFile in NORMAL mode, the midi file starts but then the code keeps going and exits to the next page. When I use the WAIT mode, it waits just fine, however, I can't use my "Cancel" button which has the Stop Media action command.

The only way I have been able to make it work is by using the Delay command which let's the program start and wait while it counts off a specified amount of time. While this works, it is not very practical given the number of midi files I have.

Is there another way to do this without having to know then length of time it takes for a variety of midi files to play? Any suggestions?



Hi Ralph,

you have to use a MediaPlayer Object to play a mid file. Inside the General properties you can find "Variable to store Playback Position" .... Disable the object by default. And use the Action command MediaPlayerPlay to start the Player-Object playing. All you now have to do is, to check the used variable from the MediaPlayer object.




If i understand what you want,you can use MediaPlayer object to play MIDI file (set not visible on dialog) and put the GotoNextPage action on the Finished Playing tab on the MediaPlayer properties.Then when the midi ends, the app goes to next page.And if the user wants to stop you can put a button to stop MediaPlayer object and gotonextpage command also.


Re: StopMedia

Muchas gracias!
Vielen dank!
Jim Brammer

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 1 guest