Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GStreamer] Cannot play mp4 videos in Element: Received unexpected 200 HTTP status code for range request #19687

Closed
wants to merge 1 commit into from

Conversation

philn
Copy link
Member

@philn philn commented Oct 29, 2023

e14eade

[GStreamer] Cannot play mp4 videos in Element: Received unexpected 200 HTTP status code for range request
https://bugs.webkit.org/show_bug.cgi?id=221622

Reviewed by NOBODY (OOPS!).

https://tools.ietf.org/id/draft-ietf-httpbis-p5-range-09.html#header.content-range
If the server ignores a byte - range - spec because it is syntactically invalid, the
server SHOULD treat the request as if the invalid Range header field did not
exist. Normally, this means return a 200 response containing the full entity.

* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::responseReceived):

e14eade

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl ❌ πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 ❌ πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim
βœ… πŸ›  watch
βœ… πŸ›  watch-sim

…0 HTTP status code for range request

https://bugs.webkit.org/show_bug.cgi?id=221622

Reviewed by NOBODY (OOPS!).

https://tools.ietf.org/id/draft-ietf-httpbis-p5-range-09.html#header.content-range
If the server ignores a byte - range - spec because it is syntactically invalid, the
server SHOULD treat the request as if the invalid Range header field did not
exist. Normally, this means return a 200 response containing the full entity.

* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::responseReceived):
@philn philn self-assigned this Oct 29, 2023
@philn philn added the Media Bugs related to the HTML 5 Media elements. label Oct 29, 2023
@philn philn requested a review from calvaris October 29, 2023 10:06
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 29, 2023
@calvaris
Copy link
Contributor

I think @ntrrgc had an opinion about this.

Copy link
Contributor

@ntrrgc ntrrgc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safari doesn't support media from servers without Content-Range support. Content-Range is needed for reasonable seek support. To support media without Content-Range it's necessary to store the entire file in memory, and a seek to time can only be implemented by downloading the entire file from the start.

@ntrrgc
Copy link
Contributor

ntrrgc commented Oct 30, 2023

If you really want to support servers without Content-Range support, the following issues need to be addressed:

  1. If any RAM or file system cache is used, there must be a relatively small file size limit under which playback will be refused (if the server declares Content-Length) or aborted (if the server doesn't declare Content-Length but such length is reached). This must be communicated to users and developers through the browser console.
  2. The pipeline must ensure no further seeks are sent to the source element. Instead, seeks to the future must be satisfied by waiting until buffering reaches the requested position, and seeks to the past must be satisfied from cached media. Otherwise, casual generous seeking from users would be very unresponsive and consume a lot of unnecessary network data.

@philn
Copy link
Member Author

philn commented Oct 30, 2023

Safari doesn't support media from servers without Content-Range support.

Are you sure about this?

@ntrrgc
Copy link
Contributor

ntrrgc commented Oct 30, 2023

Safari doesn't support media from servers without Content-Range support.

Are you sure about this?

Yes, pretty much. For instance: https://stephenweiss.dev/safari-streaming-video

@philn philn closed this Oct 30, 2023
@eric-carlson
Copy link
Contributor

Safari doesn't support media from servers without Content-Range support.

Are you sure about this?

Yes, pretty much. For instance: https://stephenweiss.dev/safari-streaming-video

While the Apple media frameworks WebKit uses require Content-Range support, WebKit now works around this when loading data from servers without support by synthesizing range requests. See for example https://github.com/WebKit/WebKit/blob/main/Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaLoading.mm

@ntrrgc
Copy link
Contributor

ntrrgc commented Oct 31, 2023

@eric-carlson What do you mean with synthesizing range requests? I see a RangeRequestSynthesisWithoutContentLength test that removes the Content-Length header. Is the purpose of that make WebKit believe the content is a live stream and therefore shouldn't receive seeks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Media Bugs related to the HTML 5 Media elements. merging-blocked Applied to prevent a change from being merged
Projects
None yet
6 participants