Source language: Translate to:

About mediaplayer problem

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

About mediaplayer problem

Postby carlos torres » Wed May 06, 2009 3:40 pm

Dear NBTeam

TIA

When I start the app that use a MediaPlayer Object It HAS TO be assigned a file (path + filename) to it. It doesn't support using a variable in the Media File field. If I use a variable then NB shows an error: File not found.

When I click on a button then I can choose/select form an activities menu an audio file. That selection is assigned to a variable... and here is the problem


At the beginning I have to use
Code: Select all
E:\NBK\English Time\Audio\ET5_CD1\01 - ET5 Cd1 - Units 1 to 5.mp3

What I need is
Code: Select all
PlaySoundFile "[PubDir][File]" "Normal"

Where [File] according to the menu selection is
Code: Select all
If "[Track]" "=" "17"
    SetVar  "[File]" "Audio\ET5_CD1\17 - ET5 Cd1 - Units 1 TO 5.mp3"
EndIf
-...and so on
-...
PlaySoundFile "[PubDir][File]" "Normal"


How can I avoid this error?
I really need to use variables for every selections.

regards
carlost
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Postby Neosoft Support » Wed May 06, 2009 4:07 pm

You can use a variable in place of a file name in a Media Player object, but multiple variables won't work. For example, you're using:

[PubDir][File]

[File] is empty when your pub starts, but [PubDir] isn't, which causes the Media Player to attempt to load [PubDir] which results in an error.

Instead what you need to do is replace the Media Player's variable with only:

[File]

Then change your code to combine [PubDir] with the name of the file. For example:

Code: Select all
If "[Track]" "=" "17"
    SetVar  "[File]" "[PubDir]Audio\ET5_CD1\17 - ET5 Cd1 - Units 1 TO 5.mp3"
EndIf
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

About mediaplayer problem

Postby carlos torres » Wed May 06, 2009 6:18 pm

Dear NB Support team

Thanks for your quick answer.

At the startup section I have
Code: Select all
...///
.../// presentation and credit audio
SetVar  "[File]" "Audio\ET5_CD1\01 - ET5 Cd1 - Units 1 to 5.mp3"
PlaySoundFile "[PubDir]\[File]" "Normal"
...///

and it works fine

According to your suggestion I declared and use a variable w/ mplayer
Code: Select all
SetVar  "[PubDir]\[File]" "Audio\ET5_CD1\01 - ET5 Cd1 - Units 1 to 5.mp3"


In this way mplayer works ok

Thanks again
regards
carlost
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Postby Neosoft Support » Thu May 07, 2009 10:11 am

You should not add a backslash after [PubDir]. For example:

PlaySoundFile "[PubDir][File]" "Normal"

According to your suggestion I declared and use a variable w/ mplayer
Code:
SetVar "[PubDir]\[File]" "Audio\ET5_CD1\01 - ET5 Cd1 - Units 1 to 5.mp3"


This should be changed to:

Code: Select all
SetVar  "[File]" "[PubDir]Audio\ET5_CD1\01 - ET5 Cd1 - Units 1 to 5.mp3"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

One more question about Mediaplayer

Postby carlos torres » Thu May 07, 2009 1:45 pm

Thanks NB Support team

Thanks for tyour time, Now the app is working smoothly.

I have one more question: When I select from the menu any topic mplayer plays it correctly BUT if I press pause and resume the file it start again from the beginning.

How it comes?
What I want is to resume where I paused it. How can I avoid this?

regards
carlost
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Postby Neosoft Support » Fri May 08, 2009 9:32 am

I have one more question: When I select from the menu any topic mplayer plays it correctly BUT if I press pause and resume the file it start again from the beginning.


It may depend on the driver you're using. On my PC, when i press pause and play, the file picks up from where it left off.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest