parent
e31b61e491
commit
d03c15d15c
|
@ -31,4 +31,18 @@ object FeatureFlags {
|
||||||
* reload.
|
* reload.
|
||||||
*/
|
*/
|
||||||
const val pullToRefreshEnabled = false
|
const val pullToRefreshEnabled = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integration of media features provided by `feature-media` component:
|
||||||
|
* - Background playback without the app getting killed
|
||||||
|
* - Media notification with play/pause controls
|
||||||
|
* - Audio Focus handling (pausing/resuming in agreement with other media apps)
|
||||||
|
* - Support for hardware controls to toggle play/pause (e.g. buttons on a headset)
|
||||||
|
*
|
||||||
|
* Behind nightly flag until all related Android Components issues are fixed and QA has signed
|
||||||
|
* off.
|
||||||
|
*
|
||||||
|
* https://github.com/mozilla-mobile/fenix/issues/4431
|
||||||
|
*/
|
||||||
|
val mediaIntegration = nightly or debug
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,13 @@ import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.Companion.SAFE_BROWSING_ALL
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.Companion.SAFE_BROWSING_ALL
|
||||||
import mozilla.components.concept.engine.mediaquery.PreferredColorScheme
|
import mozilla.components.concept.engine.mediaquery.PreferredColorScheme
|
||||||
import mozilla.components.concept.fetch.Client
|
import mozilla.components.concept.fetch.Client
|
||||||
|
import mozilla.components.feature.media.MediaFeature
|
||||||
import mozilla.components.feature.media.RecordingDevicesNotificationFeature
|
import mozilla.components.feature.media.RecordingDevicesNotificationFeature
|
||||||
|
import mozilla.components.feature.media.state.MediaStateMachine
|
||||||
import mozilla.components.feature.session.HistoryDelegate
|
import mozilla.components.feature.session.HistoryDelegate
|
||||||
import mozilla.components.lib.crash.handler.CrashHandlerService
|
import mozilla.components.lib.crash.handler.CrashHandlerService
|
||||||
import org.mozilla.fenix.AppRequestInterceptor
|
import org.mozilla.fenix.AppRequestInterceptor
|
||||||
|
import org.mozilla.fenix.FeatureFlags
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.test.Mockable
|
import org.mozilla.fenix.test.Mockable
|
||||||
import org.mozilla.fenix.utils.Settings
|
import org.mozilla.fenix.utils.Settings
|
||||||
|
@ -78,7 +81,7 @@ class Core(private val context: Context) {
|
||||||
historyTrackingDelegate = HistoryDelegate(historyStorage),
|
historyTrackingDelegate = HistoryDelegate(historyStorage),
|
||||||
preferredColorScheme = getPreferredColorScheme(),
|
preferredColorScheme = getPreferredColorScheme(),
|
||||||
automaticFontSizeAdjustment = Settings.getInstance(context).shouldUseAutoSize,
|
automaticFontSizeAdjustment = Settings.getInstance(context).shouldUseAutoSize,
|
||||||
suspendMediaWhenInactive = true
|
suspendMediaWhenInactive = !FeatureFlags.mediaIntegration
|
||||||
)
|
)
|
||||||
|
|
||||||
GeckoEngine(context, defaultSettings, runtime)
|
GeckoEngine(context, defaultSettings, runtime)
|
||||||
|
@ -125,6 +128,14 @@ class Core(private val context: Context) {
|
||||||
.whenGoingToBackground()
|
.whenGoingToBackground()
|
||||||
.whenSessionsChange()
|
.whenSessionsChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FeatureFlags.mediaIntegration) {
|
||||||
|
MediaStateMachine.start(sessionManager)
|
||||||
|
|
||||||
|
// Enable media features like showing an ongoing notification with media controls when
|
||||||
|
// media in web content is playing.
|
||||||
|
MediaFeature(context).enable()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue