Search in sources :

Example 6 with Danmakus

use of master.flame.danmaku.danmaku.model.android.Danmakus 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;
}
Also used : BaseDanmakuParser(master.flame.danmaku.danmaku.parser.BaseDanmakuParser) BiliDanmukuParser(master.flame.danmaku.danmaku.parser.android.BiliDanmukuParser) Danmakus(master.flame.danmaku.danmaku.model.android.Danmakus) ILoader(master.flame.danmaku.danmaku.loader.ILoader) IllegalDataException(master.flame.danmaku.danmaku.loader.IllegalDataException)

Example 7 with Danmakus

use of master.flame.danmaku.danmaku.model.android.Danmakus in project DanmakuFlameMaster by Bilibili.

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;
}
Also used : BaseDanmakuParser(master.flame.danmaku.danmaku.parser.BaseDanmakuParser) IDanmakus(master.flame.danmaku.danmaku.model.IDanmakus) Danmakus(master.flame.danmaku.danmaku.model.android.Danmakus) ILoader(master.flame.danmaku.danmaku.loader.ILoader) IllegalDataException(master.flame.danmaku.danmaku.loader.IllegalDataException)

Example 8 with Danmakus

use of master.flame.danmaku.danmaku.model.android.Danmakus in project DanmakuFlameMaster by Bilibili.

the class DrawTask method getVisibleDanmakusOnTime.

@Override
public IDanmakus getVisibleDanmakusOnTime(long time) {
    long beginMills = time - mContext.mDanmakuFactory.MAX_DANMAKU_DURATION - 100;
    long endMills = time + mContext.mDanmakuFactory.MAX_DANMAKU_DURATION;
    IDanmakus subDanmakus = danmakuList.subnew(beginMills, endMills);
    final IDanmakus visibleDanmakus = new Danmakus();
    if (null != subDanmakus && !subDanmakus.isEmpty()) {
        subDanmakus.forEachSync(new IDanmakus.DefaultConsumer<BaseDanmaku>() {

            @Override
            public int accept(BaseDanmaku danmaku) {
                if (danmaku.isShown() && !danmaku.isOutside()) {
                    visibleDanmakus.addItem(danmaku);
                }
                return ACTION_CONTINUE;
            }
        });
    }
    return visibleDanmakus;
}
Also used : BaseDanmaku(master.flame.danmaku.danmaku.model.BaseDanmaku) IDanmakus(master.flame.danmaku.danmaku.model.IDanmakus) Danmakus(master.flame.danmaku.danmaku.model.android.Danmakus) IDanmakus(master.flame.danmaku.danmaku.model.IDanmakus)

Example 9 with Danmakus

use of master.flame.danmaku.danmaku.model.android.Danmakus in project DanmakuFlameMaster by Bilibili.

the class DrawTask method seek.

@Override
public void seek(long mills) {
    reset();
    mContext.mGlobalFlagValues.updateVisibleFlag();
    mContext.mGlobalFlagValues.updateFirstShownFlag();
    mContext.mGlobalFlagValues.updateSyncOffsetTimeFlag();
    mContext.mGlobalFlagValues.updatePrepareFlag();
    mRunningDanmakus = new Danmakus(Danmakus.ST_BY_LIST);
    mStartRenderTime = mills < 1000 ? 0 : mills;
    mRenderingState.reset();
    mRenderingState.endTime = mStartRenderTime;
    mLastBeginMills = mLastEndMills = 0;
    if (danmakuList != null) {
        BaseDanmaku last = danmakuList.last();
        if (last != null && !last.isTimeOut()) {
            mLastDanmaku = last;
        }
    }
}
Also used : BaseDanmaku(master.flame.danmaku.danmaku.model.BaseDanmaku) IDanmakus(master.flame.danmaku.danmaku.model.IDanmakus) Danmakus(master.flame.danmaku.danmaku.model.android.Danmakus)

Example 10 with Danmakus

use of master.flame.danmaku.danmaku.model.android.Danmakus in project DanmakuFlameMaster by Bilibili.

the class DanmakuTouchHelper method touchHitDanmaku.

private IDanmakus touchHitDanmaku(final float x, final float y) {
    final IDanmakus hitDanmakus = new Danmakus();
    mDanmakuBounds.setEmpty();
    IDanmakus danmakus = danmakuView.getCurrentVisibleDanmakus();
    if (null != danmakus && !danmakus.isEmpty()) {
        danmakus.forEachSync(new IDanmakus.DefaultConsumer<BaseDanmaku>() {

            @Override
            public int accept(BaseDanmaku danmaku) {
                if (null != danmaku) {
                    mDanmakuBounds.set(danmaku.getLeft(), danmaku.getTop(), danmaku.getRight(), danmaku.getBottom());
                    if (mDanmakuBounds.contains(x, y)) {
                        hitDanmakus.addItem(danmaku);
                    }
                }
                return ACTION_CONTINUE;
            }
        });
    }
    return hitDanmakus;
}
Also used : BaseDanmaku(master.flame.danmaku.danmaku.model.BaseDanmaku) IDanmakus(master.flame.danmaku.danmaku.model.IDanmakus) Danmakus(master.flame.danmaku.danmaku.model.android.Danmakus) IDanmakus(master.flame.danmaku.danmaku.model.IDanmakus)

Aggregations

Danmakus (master.flame.danmaku.danmaku.model.android.Danmakus)11 ILoader (master.flame.danmaku.danmaku.loader.ILoader)7 IllegalDataException (master.flame.danmaku.danmaku.loader.IllegalDataException)7 IDanmakus (master.flame.danmaku.danmaku.model.IDanmakus)7 BaseDanmakuParser (master.flame.danmaku.danmaku.parser.BaseDanmakuParser)7 BaseDanmaku (master.flame.danmaku.danmaku.model.BaseDanmaku)4 BiliDanmukuParser (master.flame.danmaku.danmaku.parser.android.BiliDanmukuParser)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 DataFormatException (java.util.zip.DataFormatException)2 BiliDanmukuParser (com.example.gsyvideoplayer.utils.BiliDanmukuParser)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1 HttpConnection (org.jsoup.helper.HttpConnection)1 Response (org.jsoup.helper.HttpConnection.Response)1 Subscriber (rx.Subscriber)1