Android Media Player发送了一个神秘的请求

时间:2013-06-05 08:47:30

标签: php android apache http media-player

我测试了播放视频的Android应用程序。 问题是视频播放失败并出现未知错误:

MediaPlayer(20533): Error (1,-2147483648)

申请代码:

// Place the video view.
mVideoView = (VideoView) findViewById(R.id.surface_view);

// Retrieve the video path.
path = getIntent().getStringExtra(PATH);
Log.i(TAG, "Play the file : " + path);

// Set the video to play.
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
// Start the video play.
mVideoView.start();

为视频提供服务的Web服务器是带有PHP 5的Apache2。

HTTP请求:

第一个:

GET /.../hsf6bfs9/android.mp4 HTTP/1.1
Host: site.com
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.2.2)
Accept-Encoding: gzip,deflate

HTTP/1.1 200 OK
Date: Tue, 04 Jun 2013 16:57:42 GMT
Server: Apache
Cache-Control: public
Content-Transfer-Encoding: binary
Content-Disposition: inline; filename="android.mp4"
Accept-Ranges: bytes
Content-Range: bytes 0-5245532/5245533
Content-Length: 5245533
Keep-Alive: timeout=30, max=100
Connection: Keep-Alive
Content-Type: video/mp4

第二个:

GET /.../hsf6bfs9/android.mp4 HTTP/1.1
Host: site.com
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.2.2)
Accept-Encoding: gzip,deflate
Range: bytes=4927056-

HTTP/1.1 206 Partial Content
Date: Tue, 04 Jun 2013 16:57:45 GMT
Server: Apache
X-Mod-H264-Streaming: version=2.2.7
Content-Length: 318511
Last-Modified: Tue, 04 Jun 2013 16:57:43 GMT
ETag: "36bc00b-500a5d-4de56facaefc0;5245567"
Accept-Ranges: bytes
Content-Range: bytes 4927056-5245566/5245567
Keep-Alive: timeout=30, max=100
Connection: Keep-Alive
Content-Type: video/mp4

失败前的最后一个:

GET /.../hsf6bfs9/android.mp4 HTTP/1.1
Host: site.com
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.2.2)
Accept-Encoding: gzip,deflate
Range: bytes=3591808430-

HTTP/1.1 416 Requested Range Not Satisfiable
Date: Tue, 04 Jun 2013 16:57:47 GMT
Server: Apache
Keep-Alive: timeout=30, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>416 Requested Range Not Satisfiable</title>
</head><body>
<h1>Requested Range Not Satisfiable</h1>
<p>None of the range-specifier values in the Range
request-header field overlap the current extent
of the selected resource.</p>
</body></html>

发现日志:

06-05 10:23:06.577: I/NuCachedSource2(161): new range: offset= 4927056
06-05 10:23:07.618: I/NuCachedSource2(161): ERROR_END_OF_STREAM
06-05 10:23:07.618: I/NuCachedSource2(161): new range: offset= 3591808430
06-05 10:23:07.618: I/ChromiumHTTPDataSource(161): Reconnecting...
06-05 10:23:07.638: D/overlay(158): Unset pipe=RGB1 dpy=0; 
06-05 10:23:07.788: I/ChromiumHTTPDataSourceSupport(161): We requested a content range, but server didn't support that. (responded with 416)
06-05 10:23:07.788: I/ChromiumHTTPDataSource(161): Reconnect failed w/ err 0xffffffe0
06-05 10:23:07.788: E/MediaPlayer(19641): error (1, -2147483648)

你对这个问题有所了解吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

根据doc,使用常量USE_DEFAULT_STREAM_TYPE抛出此错误。

  

建议使用默认流类型。这可能并非全部使用   需要放置一个流类型。

     

常数值:-2147483648(0x80000000)

5月this回答帮助。也许mediaPlayer没有正确的权限来播放此文件,因此您可以查看this

最后,您可以查看this thread,表明Android不支持视频编码。

希望这有助于=)