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

Support range requests #133

Open
MarcelloTheArcane opened this issue May 27, 2020 · 5 comments
Open

Support range requests #133

MarcelloTheArcane opened this issue May 27, 2020 · 5 comments

Comments

@MarcelloTheArcane
Copy link

At the moment, if I try to seek to a position with an HTML audio element, it restarts the audio.

Could HTTP range requests be supported, so that I can seek to places in music?

@MarcelloTheArcane
Copy link
Author

Some handy docs:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests

  1. Add the Accept-Ranges: bytes header to media requests
  2. Return Content-Range: 0-/<total> header by default, with a 200 status
  3. If a Range header is present on the request, return the appropriate ranges with a 206 status and Content-Range: <start>-<end>/<total> header.

It should be possible to set up round about here in the code, I'm not too sure how to implement it.

gmusicproxy/GMusicProxy

Lines 285 to 293 in 47eb52e

mp3 = opener.open(url)
logger.debug('tag size: %s byte', tagsSize)
logger.debug('content estimated size: %s byte', songSize)
if mp3.info().get('Content-Length'):
songSize = int(mp3.info().get('Content-Length'))
logger.debug('content size from HTTP headers: %s byte', songSize)
self._send_headers(200, 'audio/mpeg', 'inline; filename=%s.mp3' % id.strip(), ((tagsSize if not do_shoutcast else 0) + songSize) if (songSize > 0)
else None, downloadBlockSize if do_shoutcast else None, self._icy_name(tags.album, tags.artist, tags.title) if config['shoutcast_metadata'] else None)

@jdwoody
Copy link
Collaborator

jdwoody commented May 28, 2020

We could make this work, I've noticed this issue from time to time when navigating in volumio and/or mpd. The get_song method can use some clean up and I'm focusing on the YT music migration, but will work this in as time allows.

@MarcelloTheArcane
Copy link
Author

@jdwoody Are updates pretty much on hold till we have the YT music integration?

@jdwoody
Copy link
Collaborator

jdwoody commented Jun 3, 2020

No, updates are not on hold. I'll be cutting releases. I was looking at moving to Flask for serving content, which provides easier route configuration, Swagger docs, etc. I'm not sure how involved this will be. If you can provide some documentation/code that would start play at a certain offset, I will try to work it in.

@MarcelloTheArcane
Copy link
Author

I'm not that confident coding with Python, so this is something I've found - not sure if you can make something of it: https://gist.github.com/lizhiwei/7885108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants