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

  • Home
  • SEARCH
  • 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 4049166
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:54:38+00:00 2026-05-20T13:54:38+00:00

I want to play an audiostream from a url that is only valid for

  • 0

I want to play an audiostream from a url that is only valid for a temporary amount of time. This doesn’t play very well just by using the built in stagefright streaming functionality because of the buffering mechanism (the url will be dead by the time the buffer is filled for the second time), so I have implemented a proxy stream, similar to what is done in the npr app

http://code.google.com/p/npr-android-app/source/browse/trunk/Npr/src/org/npr/android/news/StreamProxy.java

This actually works very nicely, with one exception, any seek call effectively breaks the proxy stream. I am having a hard time determining exactly how the seeking works in stagefright. Everytime I seek I get a message of

01-12 13:35:57.201: ERROR/(4870): Connection reset by peer
01-12 13:35:57.201: ERROR/(4870): java.net.SocketException: Connection reset by peer
01-12 13:35:57.201: ERROR/(4870): at org.apache.harmony.luni.platform.OSNetworkSystem.writeSocketImpl(Native Method)
01-12 13:35:57.201: ERROR/(4870):     at org.apache.harmony.luni.platform.OSNetworkSystem.write(OSNetworkSystem.java:723)
01-12 13:35:57.201: ERROR/(4870):     at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:578)
01-12 13:35:57.201: ERROR/(4870):     at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:59)
01-12 13:35:57.201: ERROR/(4870):     at com.soundcloud.utils.StreamProxy.processRequest(StreamProxy.java:209)

Then a pause for a few seconds, thafter which stagefright retries to connect to the same url, and usually throws an error (I would imagine because the proxy stream hasn’t been reset). Another potential problem is that it seems as though the proxy stream will always read the data source linearly:

while (isRunning && (readBytes = data.read(buff, 0, buff.length)) != -1) 

And I am only guessing, but I would think that in order to support seeking, the proxy would have to be able to provide an offset when reading from the buffer. Is there a way to figure out the requested offset from the socket client (the intended seek position)?

My experience with sockets is limited. Does anybody have suggestions on implementation here?

  • 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-05-20T13:54:38+00:00Added an answer on May 20, 2026 at 1:54 pm

    The MediaPlayer is issuing HTTP range requests, which specifies the byte offsets that the player expects. You can read these range values from the headers of the request submitted to your proxy server. You can then open send just these ranges back to the MediaPlayer.

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

Sidebar

Related Questions

I want to play video from a URL. How do I do this?
I want to play a video from a url in a VideoView: @Override protected
i want to play the video of this URL http://www.youtube.com/watch?v=JPUWNcGDyvM&feature=player_embedded where i PAUSE last
I want to play a sound like this: #define url(x) [NSURL URLWithString:x] .... AVAudioPlayer
I want to play a specific playlist (that was constructed as an iMix) from
I want to play some videos with audio from different audio files. For this
I want to play the music from internet by url. I create a simply
I want to play the audio that was received from IP Camera. The format
I have Url like http://www.logisticinfotech.com/client/Malasiya%20Cup/movie.mp4 i want play this video in my video player
Want to play a file that on path like this /var/spool/sound/dog.wav present on server.

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.