File: README.md

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (63 lines) | stat: -rw-r--r-- 2,793 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Overview
This component is used to interface with Mac OS's MPNowPlayingInfoCenter and
related MediaPlayer API:
https://developer.apple.com/documentation/mediaplayer/mpnowplayinginfocenter

This includes an interface for MPRemoteCommandCenter, which can be used to
receive media-related user input (e.g. media keys and actions that are
available through the MPNowPlayingInfoCenter such as repeat and rating).
https://developer.apple.com/documentation/mediaplayer/mpremotecommandcenter

Note that these APIs are only available on Mac OS 10.12.2 or later.

This README.md primarily aims to overview the mac specific components of
System Media Controls.

For overview documentation see
`//content/browser/media/system_media_controls/README.md`

# Bridged system media controls

Starting in M130, desktop PWAs (dPWAs) have their own instanced System Media
Controls. In this folder, the mac specific implementation is implemented to
support PWA app shims communicating with MPNowPlayingInfoCenter and related
MediaPlayer APIs via SystemMediaControlsBridge.

dPWAs on macOS are hosted using an app shim process, an external process to
Chrome that communicates via mojo. This process helps with the dPWA's identity
on macOS - as to appear as a standalone application to macOS.

We leverage this app shim process to speak with macOS' media APIs so that dPWAs
show up as a separate app to Chromium playing media.

# Diagram

![Mac SMC Diagram](mac_smc_diagram.jpeg)

`system_media_controls_bridge.h` describes a class that can be instantiated
sometimes 'in-process' (with respect to the browser process) or 'out-of-process'
(within each dPWA app shim process). This allows us to write the code that
speaks to macOS once, but use it from within the browser process for the browser
singleton System Media Controls and reuse it any number of times from each app
shim process to represent an independent app playing audio.

To achieve this 'bridge' concept, `remote_cocoa/system_media_controls.mojom`
describes a communication interface that allows `SystemMediaControlsMac` to
speak with the `SystemMediaControlsBridge` without knowing whether its core
functionality (implemented by `...Bridge`) resides in or out of process.

In the scenario that an out of process bridge is required for dPWAs, we leverage
the existing ApplicationBridge interface with app shims to facilitate its
creation. See `//components/remote_cocoa/app_shim/application_bridge.h`.

# Other classes

`now_playing_info_center_delegate[_cocoa]` is used to pass information to macOS.

`remote_command_center_deleate[_cocoa]` is used to receive messages from macOS
such as a request to pause or play.

# Design docs

Design docs are available in the overview documentation here:
`//content/browser/media/system_media_controls/README.md`