Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8822255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:03:42+00:00 2026-06-14T06:03:42+00:00

I have a MongoDB database with audio files stored in GridFS. HTML5 audio tag

  • 0

I have a MongoDB database with audio files stored in GridFS. HTML5 audio tag works with a link to a method that gets audio from MongoDB:

$file = $grid->findOne(array('_id' => new MongoId($id)));
header('Content-Length: ' . $file->file['length']);
header('Content-Type: ' . $file->file['file_type']);
header("Content-Disposition: filename=" . $file->file['filename']);
echo $file->getBytes();

All is good but one thing: I can’t use slidebar to skip through audio, it only plays from start to end.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:03:43+00:00Added an answer on June 14, 2026 at 6:03 am

    Try adding an Accept-Ranges = bytes header. From http://html5doctor.com/html5-audio-the-state-of-play/:

    Most audio-capable browsers enable seeking to new file positions
    during a download. To allow this, you must enable range requests on
    your server. Although enabled by default on web servers such as
    Apache, you can verify by checking that your server responds with the
    Accept-Ranges header.

    Also a X-Content-Duration = length_in_seconds header may help if the files are in ogg format. From https://developer.mozilla.org/en-US/docs/Configuring_servers_for_Ogg_media:

    The Ogg format doesn’t encapsulate the duration of media, so for the
    progress bar on the video controls to display the duration of the
    video, Gecko needs to determine the length of the media using other
    means.

    There are two ways Gecko can do this. The best way is to offer an
    X-Content-Duration header when serving Ogg media files. This header
    provides the duration of the video in seconds (not in HH:MM:SS format)
    as a floating-point value.

    Both of these headers help the browser to determine the audio’s duration before the file is fully downloaded so that seeking is possible, and the playhead can be positioned properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a meteor app that is feeding data in a MongoDB database to
I have a system that stores data into a MongoDB database. Now I need
Good day, i have mongodb database filled with some data, i ensured that data
I have a simple method as follows to write to a mongodb database. It
I have been tasked with porting data from a MongoDB database to a MySQL
I have a MongoDB database with documents that look like this: {users : [u1,
I am writing a Happstack server and I have a MongoDB database to connect
I have a MongoDB collection with data that was not saved through my Derby
I have dates stored in MongoDB using Date(), MongoDB uses UTC it's date type,
Rails 3.2.1 app name: demo database: mongoDB with mongoid I have this scaffolding set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.