Skip to content

Commit 07c1d3a

Browse files
Enable iOS background play when screen is turned off (#8211)
1 parent 1c46147 commit 07c1d3a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/plugins/htmlAudioPlayer/plugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ class HtmlAudioPlayer {
164164
elem.crossOrigin = crossOrigin;
165165
}
166166

167+
// This avoids the AudioContext being suspended when Safari is put into background
168+
if ('audioSession' in navigator) {
169+
navigator.audioSession.type = 'playback';
170+
}
171+
167172
return enableHlsPlayer(val, options.item, options.mediaSource, 'Audio').then(function () {
168173
return new Promise(function (resolve, reject) {
169174
requireHlsPlayer(async () => {

0 commit comments

Comments
 (0)