<?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>192530</bug_id>
          
          <creation_ts>2018-12-08 13:57:49 -0800</creation_ts>
          <short_desc>[GStreamer] HTMLMediaElement::m_player-&gt;paused is always true while video is playing</short_desc>
          <delta_ts>2021-06-28 14:03:41 -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>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=219354</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aboya</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>pnormand</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1486351</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-12-08 13:57:49 -0800</bug_when>
    <thetext>I was debugging why SleepDisablerGLib is broken currently. After getting a bit distracted by the inhibit portal being broken (separate bug, not our fault) I realized HTMLMediaElement is never creating SleepDisabler objects in the first place.

Turns out that when playing a YouTube video, HTMLMediaElement::shouldDisableSleep always returns early in this condition here:

    if (!m_player || m_player-&gt;paused() || loop())
        return SleepType::None;

because m_player-&gt;paused() is returning true. But this happens when the video is playing, not when it is paused. So yeah that&apos;s not good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1486352</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-12-08 14:03:20 -0800</bug_when>
    <thetext>BTW I wonder if this state tracking issue is why YouTube videos often restart improperly when moused over.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1486460</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-12-09 15:22:23 -0800</bug_when>
    <thetext>Strangely it&apos;s not a recent regression, I tried bisecting this but found this to be the case as far back as the 2.20(!) branchpoint.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1486553</commentid>
    <comment_count>3</comment_count>
    <who name="Alicia Boya García">aboya</who>
    <bug_when>2018-12-10 07:16:46 -0800</bug_when>
    <thetext>Can you confirm if this affects the non-MSE media player?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1486558</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-12-10 07:23:14 -0800</bug_when>
    <thetext>I tried to disable the setting in MiniBrowser and noted that paused() was still returning true during playback, but I&apos;m not sure if the setting really took effect or not.

Unfortunately I can&apos;t confirm outside my WebKit jhbuild because MSE is now required for YouTube video playback without H.264.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1486560</commentid>
    <comment_count>5</comment_count>
    <who name="Alicia Boya García">aboya</who>
    <bug_when>2018-12-10 07:35:42 -0800</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #4)
&gt; I tried to disable the setting in MiniBrowser and noted that paused() was
&gt; still returning true during playback, but I&apos;m not sure if the setting really
&gt; took effect or not.
&gt; 
&gt; Unfortunately I can&apos;t confirm outside my WebKit jhbuild because MSE is now
&gt; required for YouTube video playback without H.264.

What about this one? https://www.w3schools.com/html/html5_video.asp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1486622</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-12-10 10:37:17 -0800</bug_when>
    <thetext>(In reply to Alicia Boya García from comment #5)
&gt; What about this one? https://www.w3schools.com/html/html5_video.asp

OK that worked. The bug occurs the same with and without MSE.

P.S. Apparently I&apos;ve never seen that part of Big Buck Bunny. It was traumatizing. :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1506583</commentid>
    <comment_count>7</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-02-15 08:53:55 -0800</bug_when>
    <thetext>I can&apos;t reproduce this issue.

diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
index 88eae188a0e..8d2f2d18379 100644
--- a/Source/WebCore/html/HTMLMediaElement.cpp
+++ b/Source/WebCore/html/HTMLMediaElement.cpp
@@ -6896,6 +6896,7 @@ HTMLMediaElement::SleepType HTMLMediaElement::shouldDisableSleep() const
 #if !PLATFORM(COCOA) &amp;&amp; !PLATFORM(GTK) &amp;&amp; !PLATFORM(WPE)
     return SleepType::None;
 #endif
+    WTFLogAlways(&quot;paused: %d&quot;, m_player-&gt;paused());
     if (!m_player || m_player-&gt;paused() || loop())
         return SleepType::None;


$ run-minibrowser --gtk https://www.w3schools.com/html/html5_video.asp
paused: 1
paused: 1
paused: 1
paused: 1
paused: 1
paused: 1

# ^ this is expected because autoplay is disabled for this element
# now let&apos;s press play.


paused: 0
paused: 0
# Playback about to end
paused: 1
paused: 1
# Done...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1506599</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2019-02-15 09:47:00 -0800</bug_when>
    <thetext>I can confirm this seems fixed, in both WebKit JHBuild and my personal JHBuild.

Now, HTMLMediaElement::updateSleepDisabling is not being called when paused/unpaused, which is bad, but I believe we have other bug reports for that.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>