In addition to play/pause events, we need to handle the media control events for skipping to the next / previous track.
<rdar://problem/21410202>
Created attachment 254970 [details] Patch
Comment on attachment 254970 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254970&action=review > Source/WebCore/Modules/mediasession/MediaSessionManager.cpp:67 > + if (session->currentState() == MediaSession::State::Active && session->kind() == "content") Generally it’s not good for an enum value to be a string literal at each call site like this. It’s easy to have a typo and the compiler won’t catch it. I suggest making constants for these special kind values somewhere, so that we get a compile time error if we spell it wrong somewhere.
(In reply to comment #3) > Comment on attachment 254970 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=254970&action=review > > > Source/WebCore/Modules/mediasession/MediaSessionManager.cpp:67 > > + if (session->currentState() == MediaSession::State::Active && session->kind() == "content") > > Generally it’s not good for an enum value to be a string literal at each > call site like this. It’s easy to have a typo and the compiler won’t catch > it. I suggest making constants for these special kind values somewhere, so > that we get a compile time error if we spell it wrong somewhere. Fixed. I didn't see us using many string constants in WebCore.
Committed r185678: <http://trac.webkit.org/changeset/185678>
(In reply to comment #4) > (In reply to comment #3) > > Comment on attachment 254970 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=254970&action=review > > > > > Source/WebCore/Modules/mediasession/MediaSessionManager.cpp:67 > > > + if (session->currentState() == MediaSession::State::Active && session->kind() == "content") > > > > Generally it’s not good for an enum value to be a string literal at each > > call site like this. It’s easy to have a typo and the compiler won’t catch > > it. I suggest making constants for these special kind values somewhere, so > > that we get a compile time error if we spell it wrong somewhere. > > Fixed. I didn't see us using many string constants in WebCore. Look at the newer enums exposed to JavaScript, for example TextTrackMode and TextTrackKind in TextTrack.idl/.cpp/.h