use of master.flame.danmaku.danmaku.loader.ILoader in project ABPlayer by winkstu.
the class BiliVideoViewActivity method createParser.
private BaseDanmakuParser createParser(String uri) {
InputStream stream = null;
if (uri == null) {
return new BaseDanmakuParser() {
@Override
protected Danmakus parse() {
return new Danmakus();
}
};
}
try {
Response rsp = (Response) Jsoup.connect(uri).execute();
stream = new ByteArrayInputStream(CompressionTools.decompressXML(rsp.bodyAsBytes()));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (DataFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
try {
loader.load(stream);
} catch (IllegalDataException e) {
e.printStackTrace();
}
BaseDanmakuParser parser = new BiliDanmukuParser();
IDataSource<?> dataSource = loader.getDataSource();
parser.load(dataSource);
return parser;
}
use of master.flame.danmaku.danmaku.loader.ILoader in project ABPlayer by winkstu.
the class BiliVideoViewActivity method createParser.
private BaseDanmakuParser createParser(InputStream stream) {
if (stream == null) {
return new BaseDanmakuParser() {
@Override
protected Danmakus parse() {
return new Danmakus();
}
};
}
ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
try {
loader.load(stream);
} catch (IllegalDataException e) {
e.printStackTrace();
}
BaseDanmakuParser parser = new BiliDanmukuParser();
IDataSource<?> dataSource = loader.getDataSource();
parser.load(dataSource);
return parser;
}
use of master.flame.danmaku.danmaku.loader.ILoader in project bilibili-android-client by HotBitmapGG.
the class BiliDanmukuDownloadUtil method downloadXML.
public static Observable<BaseDanmakuParser> downloadXML(final String uri) {
return Observable.create(new Observable.OnSubscribe<BaseDanmakuParser>() {
@Override
public void call(final Subscriber<? super BaseDanmakuParser> subscriber) {
if (TextUtils.isEmpty(uri)) {
subscriber.onNext(new BaseDanmakuParser() {
@Override
protected IDanmakus parse() {
return new Danmakus();
}
});
}
ILoader loader = null;
try {
HttpConnection.Response rsp = (HttpConnection.Response) Jsoup.connect(uri).timeout(20000).execute();
InputStream stream = new ByteArrayInputStream(BiliDanmukuCompressionTools.decompressXML(rsp.bodyAsBytes()));
loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
loader.load(stream);
} catch (IOException | DataFormatException | IllegalDataException e) {
e.printStackTrace();
}
BaseDanmakuParser parser = new BiliDanmukuParser();
assert loader != null;
IDataSource<?> dataSource = loader.getDataSource();
parser.load(dataSource);
subscriber.onNext(parser);
}
}).subscribeOn(Schedulers.io());
}
use of master.flame.danmaku.danmaku.loader.ILoader in project GSYVideoPlayer by CarGuo.
the class DanmakuVideoPlayer method createParser.
/**
* 创建解析器对象,解析输入流
*
* @param stream
* @return
*/
private BaseDanmakuParser createParser(InputStream stream) {
if (stream == null) {
return new BaseDanmakuParser() {
@Override
protected Danmakus parse() {
return new Danmakus();
}
};
}
ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
try {
loader.load(stream);
} catch (IllegalDataException e) {
e.printStackTrace();
}
BaseDanmakuParser parser = new BiliDanmukuParser();
IDataSource<?> dataSource = loader.getDataSource();
parser.load(dataSource);
return parser;
}
use of master.flame.danmaku.danmaku.loader.ILoader in project ABPlayer by winkstu.
the class MainActivity method createParser.
private BaseDanmakuParser createParser(InputStream stream) {
if (stream == null) {
return new BaseDanmakuParser() {
@Override
protected Danmakus parse() {
return new Danmakus();
}
};
}
ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
try {
loader.load(stream);
} catch (IllegalDataException e) {
e.printStackTrace();
}
BaseDanmakuParser parser = new BiliDanmukuParser();
IDataSource<?> dataSource = loader.getDataSource();
parser.load(dataSource);
return parser;
}
Aggregations