While playing video via url at different times on different videos, it may pop up (or maybe not, but mostly pops up) MediaPlayer error : Error (1, -1004)

I read that this error is most likely related to interruption and on the http server. I searched hard, but did not find the documentation to be sure.

Please advise where you can read more about this error, or how to advise you not to fight? Maybe something is wrong in the server headers?

I'm testing on real devices.

UPDATE: The topic can be closed. I transferred everything to RTSP until they complained and God forbid they will not be :) In any case, I see no other way out.

UPDATE 2: RTSP is not supported on all Android devices. :(

  • it would be nice to stream the stream - Gorets
  • So it is buffered. Well, that is loaded, you can rewind. Or did you somehow mean otherwise? - Sever

2 answers 2

Here ( Android MediaPlayer error - 1004 ) they say that it ( Implementing a simple HTTP Server in Java to handle GET methods ) helps.

  • Thank you very much. I saw it, but I can not change the server, there is nginx :) Can I change something in the config file? But I can not change the server. Not mine :) - Sever

I do not know what your task is, but reproducing through the URL in my IMHO is a bad thing and here's why:

  • The connection is broken - you can not play the file
  • A lot of traffic that eats not only once, but constantly. It is a pity.
  • Not flexible, in regions with frequent inetom not very

Try to fix this and architectural error. Download the file to the card, put it in the cache directory and play the already downloaded file in the future.

Well, of course this is all true if the files are small or they are small. But as a whole somehow.

  • Thanks for the advice. All 3 points is a question of expediency and everyone decides for himself. All 3 points suit me. - Sever
  • @DroidAlex, and if this is a stream of radio? - Gorets
  • Radio streaming is another matter entirely. This is an unmatched data set, not a file. Therefore, all these items are not applicable there. In addition, there is a special protocol - RTMP - DroidAlex
  • Android RTSP supports and RTMP as far as I know not. In any case, I rewrite everything to RTSP, because judging by the last tests performed there is not interrupted. - Sever