I test an Android application which plays videos.
The problem is the video play fail with an unknown error:
MediaPlayer(20533): Error (1,-2147483648)
The application code :
// 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();
The web server which serves the video is an Apache2 with PHP 5.
HTTP requests:
The first:
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
The second:
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
And the final one before the fail:
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>
Logs found:
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)
Do you have an idea of the problem ?
Thanks!
According to the doc, this error is thrown with the constant 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)
May this answer help. Maybe the mediaPlayer didn't have the right permissions to play this file so you could check this.
Finally you could check this thread which suggests that the video encoding isn't supported by Android.
Hope this helps =)
Related
I am working on project based on inserting events in icalendar(iPhone) through CALDAV protocol using PHP language
In localhost the code is working fine.. when adding the same code to server using some functions, received unknown HTTP status..
I tried using dataType:"text/plain" and also I tried contentType, still not fixed.. I removed ajax function.. directly link to file.. still its showing ame error.. sometimes its shows HTTP/1.1 500 Internal Server Error and http/1.1 415 unsupported media type
last request:
PUT /rpc/calendars/mediaj11/calendar~722ea7444446*******/.ics HTTP/1.1
Host: mail.mediajenie.com:2080
Authorization: Basic **********
User-Agent: cURL based CalDAV client
Accept: */*
Content-type: text/calendar; encoding="utf-8"
Depth: 1
Content-Length: 556
last response:
HTTP/1.1 500 Internal Server Error
Date: Fri, 28 Jun 2019 10:10:48 GMT
Server: cPanel
Persistent-Auth: false
Host: mail.mediajenie.com:2080
Cache-Control: no-cache, no-store, must-revalidate, private
Connection: Keep-Alive
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 3011
Content-Type: text/html; charset=UTF-8
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Set-Cookie: PHPSESSID=5e8045144d7823ac82049d0c7ad40247; path=/
Set-Cookie: horde_secret_key=5e8045144d7823ac82049d0c7ad40247; path=/; domain=mail.mediajenie.com; HttpOnly
Set-Cookie: default_horde_view=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mail.mediajenie.com
X-Powered-By: PHP/7.2.7
So I've got a server to server application. The PHP script on server 1, domain 1 sets a custom header in the page (Authorization: Bearer 123456789). The script on server 2, domain 2 uses get_headers() to read the headers.
It all works fine when the files are served natively. But when the script on server 1 is included in a Joomla module get_headers() doesn't retrieve the custom header.
In both cases, developer tools shows the custom header but also some different headers than returned by get_headers().
The code below uses JFactory to set the headers if Joomla is loaded but it is the same result using header(). Joomla just isn't passing the custom header.
I don't get it. Anyone have any idea what is going on here? Its not a SEF or htaccess issue.
<?php
// Server 1
if(!class_exists("JFactory")){ // no Joomla
header('Authorization: Bearer 123456789');
} else { // Joomla framework loaded
$app = JFactory::getApplication();
$app->setHeader('Authorization: ', 'Bearer 123456789');
$app->sendHeaders();
}
The code on server 2:
<?php
// Server 2
$headers = get_headers("http://server1.com/");
foreach($headers as $header) {
echo $header ."<br/>";
}
Output from get_headers() when served natively:
HTTP/1.1 200 OK
Date: Thu, 19 Jan 2017 12:44:35 GMT
Server: Apache
Authorization: Bearer 123456789
Content-Length: 0
Connection: close
Content-Type: text/html
Output from get_headers() when served by Joomla:
HTTP/1.1 200 OK
Date: Thu, 19 Jan 2017 12:45:49 GMT
Server: Apache
Set-Cookie: 3c460b3da9ecb202e794816b4144c6ff=ja7mn4b4njov98lsv76kk8pvu2; path=/; HttpOnly
Vary: Accept-Encoding
Content-Length: 1264
Connection: close
Content-Type: text/html
Native headers displayed by developer tools:
Authorization: Bearer 123456789
Date: Thu, 19 Jan 2017 13:07:32 GMT
Server: Apache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Content-Length: 0
Content-Type: text/html
200 OK
Joomla headers displayed by developer tools:
Pragma: no-cache
Date: Thu, 19 Jan 2017 12:19:24 GMT
Last-Modified: Thu, 19 Jan 2017 12:19:25 GMT
Server: Apache
Authorization: : Bearer 123456789
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Content-Length: 76888
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Remove double dot from setheader call :
$app = JFactory::getApplication();
$app->setHeader('Authorization', 'Bearer 123456789');
$app->sendHeaders();
Thanks for the suggestion Yoleth. I tested this and got the same result.
However I have found the problem. The Joomla site setting the header is using a component called Site Lock. This is similar to putting the site off line but has some nice features for developers.
Basically Site Lock was preventing the page being served and just returning the headers from the lock page (as it should). I don't know why I didn't see it earlier. Sometimes just can't see the forest for the trees!
I am trying to push a page to the browser while it is being generated from a PHP script. I have no access to my hosting provider's nginx configuration but they have told me that they use nginx 1.8.1. In my phpinfo() output I can see
output_buffering 0 0
and the same script works as expected on my local PC.
This is my starting script:
<pre>
<?php
for ($i = 0; $i < 100; ++$i) {
print('<b>.</b>');
flush();
usleep(100000); // 0.1 second
}
?>
</pre>
I start getting output immediately on my local PC but I have to wait the full 10 seconds before I see anything when the page is accessed from my hosting.
These are the default response headers:
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2016 12:32:05 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.45
Content-Encoding: gzip
If I add
<?php
header('X-Accel-Buffering: no');
I get
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2016 12:35:10 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.45
Content-Encoding: gzip
<?php
header('X-Accel-Buffering: no');
header('Content-Encoding: identity');
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2016 12:37:11 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 812
Connection: keep-alive
X-Powered-By: PHP/5.4.45
Content-Encoding: identity
Obviously, if the server knows the length of the content, it has waited for the script to finish before starting to send it to the browser.
These are the headers on my local machine:
HTTP/1.1 200 OK
Date: Tue, 12 Apr 2016 12:52:31 GMT
Server: Apache/2.4.7 (Win32) PHP/5.4.45 OpenSSL/1.0.1e
X-Powered-By: PHP/5.4.45
X-Accel-Buffering: no
Content-Encoding: identity
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
The X-Accel-Buffering header gets passed through because I am not running nginx locally.
Are there any other headers I can pass through from PHP to stop nginx from buffering the content? So far I've only found config options, which I don't have access to.
i need to log the response header/code from the server?
How can i do this? With NginX or with PHP/Curl?
An example:
(This i the request from the client)
----------------Request-------------------------
GET /download.php?request=abc123xyz&link=http%3A%2F%2Fyoutube.com%2Fwatch?v=pRPOztxXWlQ HTTP/1.1
Host: api.example.com
Accept-Encoding: gzip,deflate
Cache-Control: no-cache
Pragma: no-cache
Accept-Language: de, en-gb;q=0.9, en;q=0.8
Accept: application/json
User-Agent: JDownloader
Answer from my Server (Response Code/Header)
----------------Response Information------------
Connection-Time: keep-Alive
----------------Response------------------------
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 28 Nov 2014 12:03:32 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Strict-Transport-Security: max-age=63072000; includeSubDomains
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
------------------------------------------------
I need this, because i have sometimes problems with the download of different files. My service downloads videos from some streamhoster like youtube. The output of the response code helps me to know if this a problem with my server or with the external downloader (JDownloader, Load!, ...)
Add header content in your access log with $http_<my_header> variables where <my_header> is the desired header name in lower can with dashes replaced by underscores. For instance X-Frame-Options could be logged with $http_x_frame_options added to access logformat.
I am setting this with htaccess. I know it's being set properly because if I set another header:
Header set Access-Control-Allow-Origin2: *
Then chrome does see this. As soon as I remove the 2 however, chrome just completely ignores it. If I make my file a PHP file and put this in it:
<?php header("Access-Control-Allow-Origin: *"); ?>
Then it works.
Here are the response headers as reported by Chrome of the .htaccess method which I need to work and which does not:
HTTP/1.1 304 Not Modified
Date: Sun, 30 Mar 2014 00:13:06 GMT
Server: Apache/2.2.22 (Ubuntu)
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
ETag: "208f3-178a2-4f5c4f119cd34"
Vary: Accept-Encoding
Here are the response headers as reported by Chrome from the PHP method which for some reason does work:
HTTP/1.1 200 OK
Date: Sun, 30 Mar 2014 00:13:09 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.10
Access-Control-Allow-Origin: *
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 23
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html
Again, I know the htaccess is setting the header, even if I go to an online service that checks reponse headers, I see this back:
HTTP/1.1 200 OK
Date: Sun, 30 Mar 2014 00:18:14 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Sat, 29 Mar 2014 20:48:34 GMT
ETag: "208f3-178a2-4f5c4f119cd34"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Access-Control-Allow-Origin: *
Content-Length: 33393
Content-Type: application/javascript