本文整理汇总了Java中master.flame.danmaku.danmaku.model.android.DanmakuContext.create方法的典型用法代码示例。如果您正苦于以下问题:Java DanmakuContext.create方法的具体用法?Java DanmakuContext.create怎么用?Java DanmakuContext.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类master.flame.danmaku.danmaku.model.android.DanmakuContext
的用法示例。
在下文中一共展示了DanmakuContext.create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDanmuConfig
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
/**
* 初始化配置
*/
private void initDanmuConfig() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5); // 滚动弹幕最大显示5行
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext
.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_NONE)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)//越大速度越慢
.setScaleTextSize(1.2f)
.setCacheStuffer(new BackgroundCacheStuffer(), mCacheStufferAdapter)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
}
示例2: initDanmaku
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
private void initDanmaku() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
// 滚动弹幕最大显示3行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(1.2f)
.setCacheStuffer(new SpannedCacheStuffer(), null) // 图文混排使用SpannedCacheStuffer
// .setCacheStuffer(new BackgroundCacheStuffer()) // 绘制背景使用BackgroundCacheStuffer
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
}
示例3: initMediaPlayer
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
@SuppressLint("UseSparseArrays")
private void initMediaPlayer() {
//配置播放器
MediaController mMediaController = new MediaController(this);
mMediaController.setTitle(title);
mPlayerView.setMediaController(mMediaController);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(onInfoListener);
mPlayerView.setOnSeekCompleteListener(onSeekCompleteListener);
mPlayerView.setOnCompletionListener(onCompletionListener);
mPlayerView.setOnControllerEventsListener(onControllerEventsListener);
//设置弹幕开关监听
mMediaController.setDanmakuSwitchListener(this);
//设置返回键监听
mMediaController.setVideoBackEvent(this);
//配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
//设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
//滚动弹幕最大显示5行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
//设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
//设置弹幕样式
danmakuContext = DanmakuContext.create();
danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(0.8f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
loadData();
}
示例4: initMediaPlayer
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
private void initMediaPlayer() {
MediaController controller = new MediaController(this);
controller.setTitle(mTitle);
mPlayerView.setMediaController(controller);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(mOnInfoListener);
mPlayerView.setOnSeekCompleteListener(mOnSeekCompleteListener);
mPlayerView.setOnCompletionListener(mOnCompletionListener);
mPlayerView.setOnControlEventsListener(mOnControlEventsListener);
// 设置弹幕开关监听
controller.setDanmakuSwitchListener(this);
// 设置返回键监听
controller.setVideoBackListener(this);
// 配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
// 滚动屏幕最大显示五行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
// 设置弹幕样式
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(0.8f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
loadData();
}
示例5: initUi
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
@Override
protected void initUi() {
updateVideoLayoutParams();
mVideoPlayView.setBufferingIndicator(mProgressBar);
mDanmakuView.enableDanmakuDrawingCache(true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDuplicateMergingEnabled(true);
mDanmakuView.prepare(parser, mDanmakuContext);
if (!isLandscape()) {
mDanmakuView.hideAndPauseDrawTask();
isShowDanmu = false;
}
}
示例6: startDamaku
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
/**
* 初始化弹幕
*/
public void startDamaku(Uri uri) {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5); // 滚动弹幕最大显示3行
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
danmakuContext = DanmakuContext.create();
danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3).setDuplicateMergingEnabled(false).setScrollSpeedFactor(1.2f).setScaleTextSize(1.2f)
.setCacheStuffer(new SpannedCacheStuffer()) // 图文混排使用SpannedCacheStuffer
// .setCacheStuffer(new BackgroundCacheStuffer()) // 绘制背景使用BackgroundCacheStuffer
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
if (mDanmaku != null) {
//设置弹幕地址
if(uri == null){
return;
}
String url = uri.toString();
mParser = createParser(url);
//弹幕开始监听
mDanmaku.setCallback(new MyLoadDanmakuListener());
mDanmaku.prepare(mParser, danmakuContext);
mDanmaku.showFPS(true);
mDanmaku.enableDanmakuDrawingCache(true);
}
}
示例7: initDanmuConfig
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入方法依赖的package包/类
private void initDanmuConfig() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 4); // 滚动弹幕最大显示4行
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_NONE)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)//越大速度越慢
.setScaleTextSize(1.2f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
start();
}
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
prepare(new BaseDanmakuParser() {
@Override
protected IDanmakus parse() {
return new Danmakus();
}
}, mDanmakuContext);
enableDanmakuDrawingCache(true);
}