2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] Issue https://github.com/mozilla-mobile/fenix/issues/4431: Integrate feature-media component (Nightly and debug builds only). (https://github.com/mozilla-mobile/fenix/pull/4683)

This commit is contained in:
Sebastian Kaspari 2019-08-13 22:02:20 +02:00 committed by Colin Lee
parent d7f108f7cb
commit 4cba063e4e
2 changed files with 26 additions and 1 deletions

View File

@ -31,4 +31,18 @@ object FeatureFlags {
* reload.
*/
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
}

View File

@ -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.mediaquery.PreferredColorScheme
import mozilla.components.concept.fetch.Client
import mozilla.components.feature.media.MediaFeature
import mozilla.components.feature.media.RecordingDevicesNotificationFeature
import mozilla.components.feature.media.state.MediaStateMachine
import mozilla.components.feature.session.HistoryDelegate
import mozilla.components.lib.crash.handler.CrashHandlerService
import org.mozilla.fenix.AppRequestInterceptor
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.test.Mockable
import org.mozilla.fenix.utils.Settings
@ -78,7 +81,7 @@ class Core(private val context: Context) {
historyTrackingDelegate = HistoryDelegate(historyStorage),
preferredColorScheme = getPreferredColorScheme(),
automaticFontSizeAdjustment = Settings.getInstance(context).shouldUseAutoSize,
suspendMediaWhenInactive = true
suspendMediaWhenInactive = !FeatureFlags.mediaIntegration
)
GeckoEngine(context, defaultSettings, runtime)
@ -125,6 +128,14 @@ class Core(private val context: Context) {
.whenGoingToBackground()
.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()
}
}
}