diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index b977e4d9..573cd3e3 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1421,6 +1421,18 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1421 | else if (equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.finished")) { | 1421 | else if (equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.finished")) { |
1422 | return handleMediaCommand_DocumentWidget_(d, cmd); | 1422 | return handleMediaCommand_DocumentWidget_(d, cmd); |
1423 | } | 1423 | } |
1424 | else if (equal_Command(cmd, "media.player.started")) { | ||
1425 | /* When one media player starts, pause the others that may be playing. */ | ||
1426 | const iPlayer *startedPlr = pointerLabel_Command(cmd, "player"); | ||
1427 | const iMedia * media = media_GmDocument(d->doc); | ||
1428 | const size_t num = numAudio_Media(media); | ||
1429 | for (size_t id = 1; id <= num; id++) { | ||
1430 | iPlayer *plr = audioPlayer_Media(media, id); | ||
1431 | if (plr != startedPlr) { | ||
1432 | setPaused_Player(plr, iTrue); | ||
1433 | } | ||
1434 | } | ||
1435 | } | ||
1424 | else if (equal_Command(cmd, "document.stop") && document_App() == d) { | 1436 | else if (equal_Command(cmd, "document.stop") && document_App() == d) { |
1425 | if (d->request) { | 1437 | if (d->request) { |
1426 | postCommandf_App( | 1438 | postCommandf_App( |
@@ -2064,6 +2076,8 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2064 | if (!isFinished_GmRequest(req->req)) { | 2076 | if (!isFinished_GmRequest(req->req)) { |
2065 | cancel_GmRequest(req->req); | 2077 | cancel_GmRequest(req->req); |
2066 | removeMediaRequest_DocumentWidget_(d, linkId); | 2078 | removeMediaRequest_DocumentWidget_(d, linkId); |
2079 | /* Note: Some of the audio IDs have changed now, layout must | ||
2080 | be redone. */ | ||
2067 | } | 2081 | } |
2068 | } | 2082 | } |
2069 | redoLayout_GmDocument(d->doc); | 2083 | redoLayout_GmDocument(d->doc); |