danikula / danikula/AndroidVideoCache

with Android TV

未关闭
#189 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
5.5k
派生
1.2k
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

调研方向

先从 issue 中的 App 和 PlaybackOverlayActivity 代码片段开始,然后检查涉及创建 Application 实例的 Android 应用配置。重现 Android TV 启动过程,并在 proxy 设置之前追踪 ClassCastException。应用能够在没有此 cast 错误的情况下启动,并且可以继续进行播放设置,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, java
领域
mobile-dev
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。