Return previous audio when reinserting disc

Blu-ray and UHD Authoring
Post Reply
bestbluray
Posts: 9
Joined: Sun Dec 10, 2023 2:05 pm

Return previous audio when reinserting disc

Post by bestbluray »

Sorry for my English but I'm using a translator.

How can I make this command work correctly

I have a film with the director's commentary, I put it as the fifth audio.

Let's suppose I choose audio 3 in the audio menu which is in Spanish, then I activate the director's audio and stop the disc from playing.

Now when I return the disc I want the menu to resume, continue my film in the last audio which in this case is the director's commentary, but when selecting to turn off commented audio number 5, I want it to return to audio number 3 , which was the last choice made before activating audio 5.

How can I make the command? I tried via gpr as follows


1- Language menu Audio 01
int curPlayListID = manager.getPlaylistID();
manager.setGPR(10, 5);
manager.selectAudioStream('Playlist Movie', 1, curPlayListID == 'Playlist Movie');
manager.UpdateCurrent_PM_popupaudioMenu();
manager.activateSegment("S:PM_popupsubtitlesMenu.show_menu");
manager.UpdateCurrent_PM_popupaudioMenu();
Audio 02
int curPlayListID = manager.getPlaylistID();
manager.setGPR(10, 6);
manager.selectAudioStream('Playlist Movie', 2, curPlayListID == 'Playlist Movie');
manager.UpdateCurrent_PM_popupaudioMenu();
manager.activateSegment("S:PM_popupsubtitlesMenu.show_menu");
manager.UpdateCurrent_PM_popupaudioMenu();
ETC...

02 - Menu deactivating the director's audio
int streamId = 0;
int chapterId = manager.getCurrentChapter();
int curPlayListID = manager.getPlaylistID();
if (manager.getGPR(10)==5) {
manager.selectAudioStream('Playlist Movie', 1, curPlayListID == 'Playlist Movie');
}
if (manager.getGPR(10)==6) {
manager.selectAudioStream('Playlist Movie', 2, curPlayListID == 'Playlist Movie');
}
if (manager.getGPR(10)==7) {
manager.selectAudioStream('Playlist Movie', 3, curPlayListID == 'Playlist Movie');
}
if (manager.getGPR(10)==8) {
manager.selectAudioStream('Playlist Movie', 4, curPlayListID == 'Playlist Movie');
}
{
manager.activateButtonEx("H:PM_popupMenu.Handler", "mm_bonus", false);
manager.activateSegment("S:PM_popupMenu.show_menu");
}
These commands work correctly, when you disable the comment, the audio returns to the previous one, but this is only when the disc has not been ejected

When reinserting the disc it plays where it left off with audio 5, but when I go to deactivate it does not activate audio 3 which was the last choice made.

How do I fix this problem?


I put the command in the Menu to summarize the command in YES:
int streamId = 0;
int chapterId = manager.getCurrentChapter();
int curPlayListID = manager.getPlaylistID();
{
manager.setGPR(10, 5);
}
{
manager.playMovie();
}
{
manager.Close_Popup();
}
It returns me audio 1, because the gpr is 10=5 it is the first audio, but I wanted it to activate audio 3, or 2 or 4, whichever the person chose before activating audio 5 and stopping playback




My settings in On JAR startup

manager.Store_Streams();
int streamId = 0;
int chapterId = manager.getCurrentChapter();
int curPlayListID = manager.getPlaylistID();
boolean canExec = true;
if (canExec && (manager.canResume('Playlist Movie'))) {
canExec = false;
manager.setGPR(10, 1);
manager.allowSaveState(true);
manager.saveMediaState();
manager.setStartPlayMarkResume();
manager.playVideo('Playlist Movie');
manager.activateSegment("S:Movie");
}
if (canExec) {
canExec = false;
manager.allowSaveState(true);
manager.saveMediaState();
manager.setStartPlayMark(#1);
manager.playVideo('SONY');
manager.activateSegment("S:Movie");
}
if ((curPlayListID == 'Movie')) {
streamId = manager.getCurrentAudioID();
} else {
streamId = manager.getAudioID('Movie', true);
}
if (canExec && ((streamId == 1))) {
canExec = false;
manager.setGPR(10, 5);
}

Alexey Kolesnikov
Posts: 472
Joined: Fri Mar 01, 2013 1:03 pm
Contact:

Re: Return previous audio when reinserting disc

Post by Alexey Kolesnikov »

You need to save the current audio track number in the GPR register and restore it back.
commentary ON button:

Code: Select all

int audio = manager.getAudioID('Movie', true);
if (audio < 5) {
  manager.setGPR(1, audio);
}
commentary OFF button:

Code: Select all

manager.selectAudioStream('Movie', manager.getGPR(1),  manager.getPlaylistID() == 'Movie');
To save GPR1 in player's storage: Project properties -> Advanced -> Storing parameters GPRs -> Store first ... GPRs in storage.
Best regards,
Alexey Kolesnikov

bestbluray
Posts: 9
Joined: Sun Dec 10, 2023 2:05 pm

Re: Return previous audio when reinserting disc

Post by bestbluray »

Thank you, it worked perfectly,just one last question

I have a time timeline that hides after 4 frames, I added a script so that when it reaches that time it takes it to a blank menu, but the fade out effect is not executed, it goes straight to the other menu, this it's normal? Shouldn't you do the fade out and then trigger the next command?
When I remove the script the animation occurs normally

And there's nothing wrong with the script, I'll leave the command below
if (manager.getPlaybackRate() == 0) {
manager.activateButtonEx("H:PM_Empty.Handler", "Item_1", false);
manager.activateSegment("S:PM_Empty.show_menu");
}
if (manager.getPlaybackRate() == 1) {
manager.activateButtonEx("H:PM_Empty_2.Handler", "Item_1", false);
manager.activateSegment("S:PM_Empty_2.show_menu");
}
Attachments
img.png
img.png (20.9 KiB) Viewed 7769 times

Alexey Kolesnikov
Posts: 472
Joined: Fri Mar 01, 2013 1:03 pm
Contact:

Re: Return previous audio when reinserting disc

Post by Alexey Kolesnikov »

[close popup anim] means "activate close popup animation segment that will activate S:Movie segment at the end" (if we're talking about popup of course).

If you have several activate segment commands - it usually activates the latest one. Do you really need Empty_2? [close popup anim] should be enough.
Best regards,
Alexey Kolesnikov

bestbluray
Posts: 9
Joined: Sun Dec 10, 2023 2:05 pm

Re: Return previous audio when reinserting disc

Post by bestbluray »

int audio = manager.getAudioID('Movie', true);
if (audio < 5) {
manager.setGPR(1, audio);
}
commentary OFF button:
Code: Select all

manager.selectAudioStream('Movie', manager.getGPR(1), manager.getPlaylistID() == 'Movie');

Good evening, this code works perfectly to activate the previous audio, but if you have an active subtitle it also doesn't load the last subtitle, I tried putting something like this code for the subtitles and it didn't work, I know there is the command: manager. selectAudioSubtitleStream , would that be the one you would have to use to load the last audio and the last subtitle? and what the code would look like, thank you

Alexey Kolesnikov
Posts: 472
Joined: Fri Mar 01, 2013 1:03 pm
Contact:

Re: Return previous audio when reinserting disc

Post by Alexey Kolesnikov »

Well... It should work. Just use another GPR for subtitles.

Code: Select all

int sub = manager.getSubID('Movie', true);
if (sub < 5) {
  manager.setGPR(2, sub);
}

Code: Select all

manager.selectSubtitleStream('Movie', manager.getGPR(2), manager.getPlaylistID() == 'Movie');
Yes, you can use manager.selectAudioSubtitleStream('Movie', manager.getGPR(1), manager.getGPR(2), manager.getPlaylistID() == 'Movie') to set both audio and subtitles in one command.
Best regards,
Alexey Kolesnikov

Post Reply