Jump to content

Add 'Accept-Ranges' header to attachment.php, if audio/video


Nathan Explosion

Recommended Posts

Posted

Been looking in to an issue which was brought up in regard to my HTML5 Audio/Video Player plugin, and the issue only presents itself in Google Chrome.

The problem is that uploaded attachments do not allow the player to 'seek' through the audio/video player. The cause of the problem is Chrome is being a bit tooooo serious with the media file being served back by /applications/core/interface/file/attachment.php, while other browsers are happy to play and allow the use of 'seek'. It's caused by the absence of the 'Accept-Ranges' header being sent back, and triggers the ultimate Chrome issue.

Adding the following to attachment.php will overcome this issue, so if it can be added for situations where the original file that was uploaded is an audio or video mime type then that would be lovely :D

\IPS\Output::i()->sendHeader("Accept-Ranges:bytes");

Here is a link to a page which is independent of the plugin, which plays the same audio file from 4 different sources:

  1. Served from another site
  2. Served from local site
  3. Served via the /applications/core/interface/file/attachment.php
  4. Server via my modifed version of /applications/core/interface/file/attachments.php (nathanattachment.php)

 

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...