Page 1 of 1

Java code Current subtitles and audio

Posted: Wed Nov 08, 2023 12:52 am
by rickemail
hello, could you provide me with the java code to put the current subtitle and current audio in the popup menu as soon as I activate the popup,I wanted to use the code in the UDFs function

Re: Java code Current subtitles and audio

Posted: Wed Nov 08, 2023 5:53 am
by Alexey Kolesnikov
Hello.

What do you mean in "to put in the popup menu"? Highlight the current audio/subtitle somehow? Select the appropriate button?
This depends on your menu - code will contain buttons and menus names (check the help "Advanced" -> "Script (java)" -> "Name conversion" for details).

Anyway, the easiest way to get something in java code is to create an appropriate action (assign it to any button) and then select "Script (java)" from the actions menu: this command will be converted in to the java code.

Re: Java code Current subtitles and audio

Posted: Wed Nov 08, 2023 4:06 pm
by rickemail
an example of the paramount menu, when you press Pause, it appears and shows the current audio and the current subtitle, in image 02 when I activate another subtitle, it appears in this menu, you can put this function in the bookmark menu in the UDF function to display the audio and subtitles active?

Re: Java code Current subtitles and audio

Posted: Thu Nov 09, 2023 11:06 am
by Alexey Kolesnikov
There are no such "functions". You need to create a menu with images (or texts) for all languages and move them inside/outside the screen depending on what should be visible.
For example, create a menu that contains images that say "English", "German" for audio and "On", "Off" for subtitles and use action "Settings and Properties" -> "Set object property" -> "Move to" before opening this menu to move some of them outside the screen, some inside.
Then you can convert this into the Java using the "Script (java)" action and put into the UDF.
This will be something like (depending on names, menu structure, etc...):

Code: Select all

if (manager.getCurrentAudioID() == 1) {
  manager.moveToXY("F:PM_Bookmark.SoundEnglish.Normal", 50, 1000);
  manager.moveToXY("F:PM_Bookmark.SoundGerman.Normal", 50, -1000);
  ...
}
...

Re: Java code Current subtitles and audio

Posted: Sun Nov 12, 2023 1:28 pm
by rickemail
Thanks, worked, could you provide me the java code on how to use the "manager.getPlaybackRate" function for FF/RWD/Pause/Next/Prev in "Action every second"

Re: Java code Current subtitles and audio

Posted: Sun Nov 12, 2023 3:39 pm
by Alexey Kolesnikov
1 means played
0 means pause
positive means forward (so for forward it just returns the current speed that may be any number like 2, 10, ...)
negative means rewind (the same as above, but negative: -2, -10, ...)