danikula / danikula/AndroidVideoCache
with Android TV
- Dominant language
- Java
- Stars
- 5.5k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I used this library with Android tv Project but don't work.
the application close.
**## first create class App**
import android.app.Application;
import android.content.Context;
import com.danikula.videocache.HttpProxyCacheServer
public class App extends Application {
private HttpProxyCacheServer proxy;
public static HttpProxyCacheServer getProxy(Context context) {
App app = (App) context.getApplicationContext();
return app.proxy == null ? (app.proxy = app.newProxy()) : app.proxy;
}
private HttpProxyCacheServer newProxy() {
return new HttpProxyCacheServer(this);
}
}
**## and play class**
public class PlaybackOverlayActivity extends Activity implements CacheListener {
private VideoView mVideoView;
...
public void setVideoPath(String videoUrl) {
try {
HttpProxyCacheServer proxy = App.getProxy(this);
proxy.registerCacheListener(this, videoUrl);
String proxyUrl = proxy.getProxyUrl(videoUrl);
setPosition(0);
mVideoView.setVideoPath(proxyUrl);
mStartTimeMillis = 0;
mDuration = Utils.getDuration(proxyUrl);
} catch (Exception e) {
toast(e.toString());
}
}
# the Err is
java.lang.ClassCastException:Android.app.application cannot be cast to (package name).App
thinx
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the App and PlaybackOverlayActivity snippets in the issue, then inspect the Android application configuration involved in creating the Application instance. Reproduce the Android TV launch and follow the ClassCastException before the proxy setup. Done means the application starts without this cast error and playback setup can proceed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100