Compare commits
2 Commits
v1.0.22.04
...
feature-da
Author | SHA1 | Date | |
---|---|---|---|
415280acb8 | |||
888f9d3d60 |
@ -55,13 +55,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
..addStatusLister(playerListener)
|
..addStatusLister(playerListener)
|
||||||
..addPositionListener(videoPositionListen);
|
..addPositionListener(videoPositionListen);
|
||||||
}
|
}
|
||||||
playerController.isOpenDanmu.listen((p0) {
|
danmakuStatusListen();
|
||||||
if (p0 && !_plDanmakuController.initiated) {
|
|
||||||
_plDanmakuController.initiate(
|
|
||||||
playerController.duration.value.inMilliseconds,
|
|
||||||
playerController.position.value.inMilliseconds);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
blockTypes = playerController.blockTypes;
|
blockTypes = playerController.blockTypes;
|
||||||
showArea = playerController.showArea;
|
showArea = playerController.showArea;
|
||||||
opacityVal = playerController.opacityVal;
|
opacityVal = playerController.opacityVal;
|
||||||
@ -111,6 +105,20 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 弹幕开关状态监听
|
||||||
|
void danmakuStatusListen() {
|
||||||
|
playerController.isOpenDanmu.listen((p0) {
|
||||||
|
if (p0 && !_plDanmakuController.initiated) {
|
||||||
|
_plDanmakuController.initiate(
|
||||||
|
playerController.duration.value.inMilliseconds,
|
||||||
|
playerController.position.value.inMilliseconds);
|
||||||
|
} else {
|
||||||
|
playerController.danmakuController!.pause();
|
||||||
|
playerController.danmakuController!.clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
playerController.removePositionListener(videoPositionListen);
|
playerController.removePositionListener(videoPositionListen);
|
||||||
@ -122,28 +130,23 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
return LayoutBuilder(builder: (context, box) {
|
return LayoutBuilder(builder: (context, box) {
|
||||||
// double initDuration = box.maxWidth / 12;
|
// double initDuration = box.maxWidth / 12;
|
||||||
return Obx(
|
return Obx(
|
||||||
() => AnimatedOpacity(
|
() => DanmakuView(
|
||||||
opacity: playerController.isOpenDanmu.value ? 1 : 0,
|
createdController: (DanmakuController e) async {
|
||||||
duration: const Duration(milliseconds: 100),
|
playerController.danmakuController = _controller = e;
|
||||||
child: DanmakuView(
|
},
|
||||||
createdController: (DanmakuController e) async {
|
option: DanmakuOption(
|
||||||
playerController.danmakuController = _controller = e;
|
fontSize: 15 * fontSizeVal,
|
||||||
},
|
area: showArea,
|
||||||
option: DanmakuOption(
|
opacity: opacityVal,
|
||||||
fontSize: 15 * fontSizeVal,
|
hideTop: blockTypes.contains(5),
|
||||||
area: showArea,
|
hideScroll: blockTypes.contains(2),
|
||||||
opacity: opacityVal,
|
hideBottom: blockTypes.contains(4),
|
||||||
hideTop: blockTypes.contains(5),
|
duration: danmakuDurationVal / playerController.playbackSpeed,
|
||||||
hideScroll: blockTypes.contains(2),
|
strokeWidth: strokeWidth,
|
||||||
hideBottom: blockTypes.contains(4),
|
// initDuration /
|
||||||
duration:
|
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
||||||
danmakuDurationVal / playerController.playbackSpeed,
|
|
||||||
strokeWidth: strokeWidth,
|
|
||||||
// initDuration /
|
|
||||||
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
|
||||||
),
|
|
||||||
statusChanged: (isPlaying) {},
|
|
||||||
),
|
),
|
||||||
|
statusChanged: (isPlaying) {},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user