mirror of https://github.com/FongMi/TV.git
parent
991cb864e0
commit
7831feb428
@ -1,12 +1,41 @@ |
||||
package com.fongmi.android.tv.player.danmaku; |
||||
|
||||
import com.fongmi.android.tv.utils.UrlUtil; |
||||
import com.github.catvod.net.OkHttp; |
||||
|
||||
import java.io.InputStream; |
||||
|
||||
import master.flame.danmaku.danmaku.loader.ILoader; |
||||
import master.flame.danmaku.danmaku.loader.android.BiliDanmakuLoader; |
||||
import master.flame.danmaku.danmaku.loader.android.DanmakuLoaderFactory; |
||||
import master.flame.danmaku.danmaku.loader.IllegalDataException; |
||||
import master.flame.danmaku.danmaku.parser.android.AndroidFileSource; |
||||
|
||||
public class Loader implements ILoader { |
||||
|
||||
public class Loader extends DanmakuLoaderFactory { |
||||
private AndroidFileSource dataSource; |
||||
|
||||
public Loader(String url) { |
||||
try { |
||||
load(url); |
||||
} catch (Exception ignored) { |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void load(String url) throws IllegalDataException { |
||||
try { |
||||
OkHttp.cancel("danmaku"); |
||||
dataSource = new AndroidFileSource(OkHttp.newCall(UrlUtil.convert(url), "danmaku").execute().body().byteStream()); |
||||
} catch (Exception e) { |
||||
throw new IllegalDataException(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void load(InputStream stream) throws IllegalDataException { |
||||
} |
||||
|
||||
public static ILoader create() { |
||||
return BiliDanmakuLoader.instance(); |
||||
@Override |
||||
public AndroidFileSource getDataSource() { |
||||
return dataSource; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue