2013-06-05 36 views
1

我測試了一個播放視頻的Android應用程序。 問題是視頻播放失敗,未知錯誤:Android Media Player發送一個神祕的請求

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) 

你有問題的想法? 謝謝!

回答

0

根據doc,此錯誤與常數USE_DEFAULT_STREAM_TYPE一起拋出。

Suggests using the default stream type. This may not be used in all places a stream type is needed.

Constant Value: -2147483648 (0x80000000)

5月this答案幫助。也許mediaPlayer沒有正確的權限來播放這個文件,所以你可以檢查this

最後,您可以檢查this thread這表明Android不支持視頻編碼。

希望這有助於=)