summaryrefslogtreecommitdiff
path: root/src/media.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-06-10 06:33:05 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-06-10 06:33:05 +0300
commitfdfd11b8a1a2d00c850039c8237208010236f765 (patch)
tree91b43b5f018312913d81fc0c3c27b4a9d63ea80f /src/media.c
parentf63ed76597b462c60b3a6ad89f8c165ffb87d00c (diff)
DocumentWidget: Pause audio when document changes
While document media is now kept in memory even in history, it's quite strange if audio players keep playing on a page viewed in the past without a way to control the playback.
Diffstat (limited to 'src/media.c')
-rw-r--r--src/media.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/media.c b/src/media.c
index 2ec2109d..180c28e6 100644
--- a/src/media.c
+++ b/src/media.c
@@ -469,6 +469,15 @@ iPlayer *audioPlayer_Media(const iMedia *d, iMediaId audioId) {
469 return NULL; 469 return NULL;
470} 470}
471 471
472void pauseAllPlayers_Media(const iMedia *d, iBool setPaused) {
473 for (size_t i = 0; i < size_PtrArray(&d->audio); ++i) {
474 const iGmAudio *audio = constAt_PtrArray(&d->audio, i);
475 if (audio->player) {
476 setPaused_Player(audio->player, setPaused);
477 }
478 }
479}
480
472iBool downloadInfo_Media(const iMedia *d, iMediaId downloadId, iGmMediaInfo *info_out) { 481iBool downloadInfo_Media(const iMedia *d, iMediaId downloadId, iGmMediaInfo *info_out) {
473 if (downloadId > 0 && downloadId <= size_PtrArray(&d->downloads)) { 482 if (downloadId > 0 && downloadId <= size_PtrArray(&d->downloads)) {
474 const iGmDownload *dl = constAt_PtrArray(&d->downloads, downloadId - 1); 483 const iGmDownload *dl = constAt_PtrArray(&d->downloads, downloadId - 1);