<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>229068</bug_id>
          
          <creation_ts>2021-08-12 20:54:17 -0700</creation_ts>
          <short_desc>nexttrack and previoustrack MediaSession handlers not working</short_desc>
          <delta_ts>2021-08-13 14:17:48 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Media</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=229070</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>229096</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jean-Yves Avenard [:jya]">jean-yves.avenard</reporter>
          <assigned_to name="Jean-Yves Avenard [:jya]">jean-yves.avenard</assigned_to>
          <cc>aakash_jain</cc>
    
    <cc>commit-queue</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>glenn</cc>
    
    <cc>jer.noble</cc>
    
    <cc>philipj</cc>
    
    <cc>sergio</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1784037</commentid>
    <comment_count>0</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-08-12 20:54:17 -0700</bug_when>
    <thetext>nexttrack and previoustrack MediaSession handlers not working</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784038</commentid>
    <comment_count>1</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-08-12 20:55:38 -0700</bug_when>
    <thetext>rdar://80100092</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784044</commentid>
    <comment_count>2</comment_count>
      <attachid>435471</attachid>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-08-12 21:18:13 -0700</bug_when>
    <thetext>Created attachment 435471
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784050</commentid>
    <comment_count>3</comment_count>
      <attachid>435471</attachid>
    <who name="youenn fablet">youennf</who>
    <bug_when>2021-08-13 00:07:39 -0700</bug_when>
    <thetext>Comment on attachment 435471
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435471&amp;action=review

&gt; Source/WebCore/ChangeLog:12
&gt; +        used with the MediaRemote backend, which prevents automating the test.

Could we do the following:
- Use MediaSession API to trigger adding handlers for nexttrack.
- Add an Internals.idl API to get the supported commands, which would generate a string. Validate &apos;nexttrack&apos; is in the commands?

Another approach would be to add a mock backend, which sounds feasible as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784056</commentid>
    <comment_count>4</comment_count>
      <attachid>435471</attachid>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-08-13 01:36:35 -0700</bug_when>
    <thetext>Comment on attachment 435471
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435471&amp;action=review

&gt;&gt; Source/WebCore/ChangeLog:12
&gt;&gt; +        used with the MediaRemote backend, which prevents automating the test.
&gt; 
&gt; Could we do the following:
&gt; - Use MediaSession API to trigger adding handlers for nexttrack.
&gt; - Add an Internals.idl API to get the supported commands, which would generate a string. Validate &apos;nexttrack&apos; is in the commands?
&gt; 
&gt; Another approach would be to add a mock backend, which sounds feasible as well.

What this bug caused was that if you registered a nexttrack action handler it would have registered the MR previous track message that makes Now Playing display the wrong button. 

This was the only thing wrong. If you had pressed the previous button, it would have correctly called the previoustrack handler. The mapping from MR to MediaSession is correct. 

If we had a test, all we would test is the test itself, there would be no guarantee that if that test pass the right information would reach MR.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784060</commentid>
    <comment_count>5</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2021-08-13 01:45:40 -0700</bug_when>
    <thetext>&gt; If we had a test, all we would test is the test itself, there would be no
&gt; guarantee that if that test pass the right information would reach MR.

It depends how you implement the Internals API (it would need to get the information from the MR) or how you implement the mock (it would need to replace the session manager nowPlaying manager and then query what the mock is receiving, should not be too difficult with mock in web process, but harder in GPU process).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784076</commentid>
    <comment_count>6</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-08-13 04:33:42 -0700</bug_when>
    <thetext>I will take this in another bug. The scope to implement such test will be way more difficult than the fix itself</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784079</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-08-13 04:57:28 -0700</bug_when>
    <thetext>Committed r281013 (240503@main): &lt;https://commits.webkit.org/240503@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435471.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784112</commentid>
    <comment_count>8</comment_count>
      <attachid>435471</attachid>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2021-08-13 08:50:26 -0700</bug_when>
    <thetext>Comment on attachment 435471
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435471&amp;action=review

&gt;&gt;&gt; Source/WebCore/ChangeLog:12
&gt;&gt;&gt; +        used with the MediaRemote backend, which prevents automating the test.
&gt;&gt; 
&gt;&gt; Could we do the following:
&gt;&gt; - Use MediaSession API to trigger adding handlers for nexttrack.
&gt;&gt; - Add an Internals.idl API to get the supported commands, which would generate a string. Validate &apos;nexttrack&apos; is in the commands?
&gt;&gt; 
&gt;&gt; Another approach would be to add a mock backend, which sounds feasible as well.
&gt; 
&gt; What this bug caused was that if you registered a nexttrack action handler it would have registered the MR previous track message that makes Now Playing display the wrong button. 
&gt; 
&gt; This was the only thing wrong. If you had pressed the previous button, it would have correctly called the previoustrack handler. The mapping from MR to MediaSession is correct. 
&gt; 
&gt; If we had a test, all we would test is the test itself, there would be no guarantee that if that test pass the right information would reach MR.

Making this testable could be as simple as adding `PlatformMediaSessionManager::getSupportedCommands()`, plumbing it down to `RemoteCommandListener`, and exposing that through Internals.idl.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784213</commentid>
    <comment_count>9</comment_count>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2021-08-13 14:09:56 -0700</bug_when>
    <thetext>Sees like this broke windows build
https://build.webkit.org/#/builders/67/builds/4559 failed with 240502@main (r281012)
https://build.webkit.org/#/builders/67/builds/4558 passed with 240501@main (r281011)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784215</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2021-08-13 14:10:36 -0700</bug_when>
    <thetext>Re-opened since this is blocked by bug 229096</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1784223</commentid>
    <comment_count>11</comment_count>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2021-08-13 14:17:48 -0700</bug_when>
    <thetext>Commented on wrong bug, please ignore.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>435471</attachid>
            <date>2021-08-12 21:18:13 -0700</date>
            <delta_ts>2021-08-13 04:57:29 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-229068-20210813141812.patch</filename>
            <type>text/plain</type>
            <size>2340</size>
            <attacher name="Jean-Yves Aven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