Skip to content

Commit a270460

Browse files
committed
fix fetching content info (#27)
1 parent 0264944 commit a270460

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repositories {
2121
jcenter()
2222
}
2323
dependencies {
24-
compile 'com.danikula:videocache:2.3.2'
24+
compile 'com.danikula:videocache:2.3.3'
2525
}
2626
```
2727

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ publish {
2626
userOrg = 'alexeydanilov'
2727
groupId = 'com.danikula'
2828
artifactId = 'videocache'
29-
publishVersion = '2.3.2'
29+
publishVersion = '2.3.3'
3030
description = 'Cache support for android VideoView'
3131
website = 'https://github.com/danikula/AndroidVideoCache'
3232
}

library/src/main/java/com/danikula/videocache/HttpUrlSource.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public synchronized int length() throws ProxyCacheException {
5858
@Override
5959
public void open(int offset) throws ProxyCacheException {
6060
try {
61-
connection = openConnection(offset, "GET", -1);
61+
connection = openConnection(offset, -1);
6262
mime = connection.getContentType();
6363
inputStream = new BufferedInputStream(connection.getInputStream(), DEFAULT_BUFFER_SIZE);
6464
length = readSourceAvailableBytes(connection, offset, connection.getResponseCode());
@@ -99,7 +99,7 @@ private void fetchContentInfo() throws ProxyCacheException {
9999
HttpURLConnection urlConnection = null;
100100
InputStream inputStream = null;
101101
try {
102-
urlConnection = openConnection(0, "HEAD", 10000);
102+
urlConnection = openConnection(0, 10000);
103103
length = urlConnection.getContentLength();
104104
mime = urlConnection.getContentType();
105105
inputStream = urlConnection.getInputStream();
@@ -114,15 +114,14 @@ private void fetchContentInfo() throws ProxyCacheException {
114114
}
115115
}
116116

117-
private HttpURLConnection openConnection(int offset, String method, int timeout) throws IOException, ProxyCacheException {
117+
private HttpURLConnection openConnection(int offset, int timeout) throws IOException, ProxyCacheException {
118118
HttpURLConnection connection;
119119
boolean redirected;
120120
int redirectCount = 0;
121121
String url = this.url;
122122
do {
123123
Log.d(LOG_TAG, "Open connection " + (offset > 0 ? " with offset " + offset : "") + " to " + url);
124124
connection = (HttpURLConnection) new URL(url).openConnection();
125-
connection.setRequestMethod(method);
126125
if (offset > 0) {
127126
connection.setRequestProperty("Range", "bytes=" + offset + "-");
128127
}

sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies {
3838
// compile project(':library')
3939
compile 'com.android.support:support-v4:23.1.0'
4040
compile 'org.androidannotations:androidannotations-api:3.3.2'
41-
compile 'com.danikula:videocache:2.3.2'
41+
compile 'com.danikula:videocache:2.3.3'
4242
compile 'com.viewpagerindicator:library:2.4.2-SNAPSHOT@aar'
4343
apt 'org.androidannotations:androidannotations:3.3.2'
4444
}

0 commit comments

Comments
 (0)