Skip to content

Commit 2e8531e

Browse files
author
Hiram
committed
[bugs] multi-player fixs && shaka instead dash
1 parent 4b19c7d commit 2e8531e

File tree

6 files changed

+103
-7
lines changed

6 files changed

+103
-7
lines changed

src/renderer/src/style/player/artplayer.css

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
width: 13px !important;
2323
}
2424

25-
.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes .art-danmuku-style-panel-mode.art-current {
25+
.art-danmuku-emitter
26+
.art-danmuku-left
27+
.art-danmuku-style
28+
.art-danmuku-style-panel
29+
.art-danmuku-style-panel-inner
30+
.art-danmuku-style-panel-modes
31+
.art-danmuku-style-panel-mode.art-current {
2632
background-color: #00e038 !important;
2733
border: 1px solid #00e038 !important;
2834
}
@@ -35,3 +41,50 @@
3541
.art-icon-switchOn .icon path {
3642
fill: #00d157 !important;
3743
}
44+
45+
.art-video-player.art-setting-show .art-settings {
46+
border-radius: 8px !important;
47+
}
48+
49+
/* 5.1 版本弹幕 css */
50+
.artplayer-plugin-danmuku .apd-config .apd-config-panel .apd-config-panel-inner {
51+
background: #000000bf !important;
52+
backdrop-filter: saturate(180%) blur(20px) !important;
53+
border-radius: 8px !important;
54+
}
55+
56+
.artplayer-plugin-danmuku .apd-slider .apd-slider-progress {
57+
background: linear-gradient(270deg, #00e038, #32ccff) !important;
58+
}
59+
60+
.apd-slider .apd-slider-dot {
61+
background: #fff !important;
62+
box-shadow: 0 0 15px 0 #00d157;
63+
}
64+
65+
.artplayer-plugin-danmuku .apd-toggle svg.apd-toggle-on path:nth-of-type(2) {
66+
fill: #00d157 !important;
67+
}
68+
69+
.artplayer-plugin-danmuku .apd-slider .apd-slider-points .apd-slider-point {
70+
background-color: #fff !important;
71+
}
72+
73+
.artplayer-plugin-danmuku .apd-config-other .apd-other:hover,
74+
.artplayer-plugin-danmuku .apd-modes .apd-mode:hover {
75+
color: #00d157 !important;
76+
}
77+
78+
.apd-mode svg.apd-mode-0-off path,
79+
.apd-mode svg.apd-mode-1-off path,
80+
.apd-mode svg.apd-mode-2-off path {
81+
fill: #00d157 !important;
82+
}
83+
84+
.apd-config-other .apd-other svg.apd-check-on path {
85+
fill: #00d157 !important;
86+
}
87+
88+
.artplayer-plugin-danmuku .apd-slider .apd-slider-steps .apd-slider-step {
89+
color: #ddd !important;
90+
}

src/renderer/src/style/player/dplayer.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box {
4545
border-radius: 8px !important;
4646
background-color: rgba(17, 18, 20, 0.8) !important;
47+
backdrop-filter: saturate(180%) blur(20px) !important;
4748
}
4849

4950
.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item:hover,

src/renderer/src/style/player/nplayer.css

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
.nplayer_control_volume_bars {
4747
background: rgba(17, 18, 20, 0.8) !important;
48-
box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 20px 1px;
48+
backdrop-filter: saturate(180%) blur(20px) !important;
4949
border-radius: 8px;
5050
font-size: 14px;
5151
height: 130px;
@@ -136,6 +136,8 @@
136136
.nplayer_popover-active .nplayer_popover_panel {
137137
border-radius: 8px;
138138
background-color: rgba(17, 18, 20, 0.8);
139+
backdrop-filter: saturate(180%) blur(20px);
140+
box-shadow: none !important;
139141
}
140142

141143
.nplayer_control_setting_item:hover,
@@ -157,11 +159,30 @@
157159
background: #00d157 !important;
158160
}
159161

162+
.nplayer_tooltip_content {
163+
background: rgba(17, 18, 20, 0.8);
164+
backdrop-filter: saturate(180%) blur(20px);
165+
border-radius: 8px;
166+
}
167+
168+
.nplayer_danmaku_reset {
169+
height: 28px;
170+
line-height: 28px;
171+
border-radius: 14px;
172+
background-color: #2b2b2b;
173+
text-align: center;
174+
font-size: 12px;
175+
}
176+
160177
.xg-icon-setting,
161178
.xg-icon-danmu {
162179
fill: #fff;
163180
}
164181

182+
svg.xgplayer-danmu-open-svg circle {
183+
fill: #fff;
184+
}
185+
165186
@media not all and (hover: none) {
166187
.nplayer_tooltip:hover {
167188
background: transparent !important;

src/renderer/src/utils/common/player/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* @module multi-player
33
* @brief 多播放器集成方案
44
* @author HiramWong <admin@catni.cn>
5-
* @update 2024-06-01
6-
* @version 0.0.7
5+
* @update 2024-06-02
6+
* @version 0.0.8
77
*
88
* **ChangeLog说明**:
99
* - 2024.5.12:
@@ -33,6 +33,9 @@
3333
* - 修复mpd无法播放问题-类型映射
3434
* - 修复xgplayer初始化播放器失败-plugin赋值错误
3535
* - 优化mpd播放-使用shaka库替代dash库[dash库经常卡死|反复请求同一分片]
36+
* - 修复artplayer弹幕库5.1版本-参数对齐
37+
* - 修复nplayer弹幕不滚动-BulletOption中type赋值错误
38+
* - 修复dplayer弹幕控制不生效-弹幕开关控制逻辑误删
3639
*
3740
*
3841
* ---
@@ -122,7 +125,7 @@ const playerBarrage = async (player: any, playerMode: string, data: any, options
122125
color: item[color],
123126
text: item[content],
124127
time: parseInt(item[start]),
125-
type: ['left', 'right'].includes(item[mode]) ? 'scroll' : item[mode],
128+
type: item[mode] === 'top' || item[mode] === 'bottom' ? item[mode] : 'scroll',
126129
isMe: false,
127130
force: true,
128131
}));

src/renderer/src/utils/common/player/playerModule/artplayer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ const options = {
2525
artplayerPluginDanmuku({
2626
speed: 5,
2727
danmuku: [],
28-
useWorker: true,
28+
// useWorker: true, // 5.0.1 版本参数
29+
synchronousPlayback: true, // 5.1.0 版本参数
30+
emitter: false, // 5.1.0 版本参数
2931
}),
3032
],
3133
icons: {
@@ -109,7 +111,7 @@ const barrge = (player: Artplayer, comments: any, url: string, id: string) => {
109111
const create = (options: any): Artplayer => {
110112
if (options.isLive) {
111113
delete options?.plugins;
112-
};
114+
}
113115

114116
Artplayer.PLAYBACK_RATE = [0.5, 0.75, 1, 1.25, 1.5, 2];
115117
return new Artplayer({ ...options });

src/renderer/src/utils/common/player/playerModule/dplayer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,20 @@ const create = (options: any): any => {
171171
</div>
172172
`,
173173
);
174+
}
175+
176+
// 弹幕事件处理
177+
const handleDanmuClick = () => {
178+
let showDanmaku: any = document.querySelector('.dplayer-setting-showdan');
179+
(player.template.showDanmakuToggle.checked = !player.template.showDanmakuToggle.checked),
180+
player.template.showDanmakuToggle.checked
181+
? ((showDanmaku = !0),
182+
player.danmaku.show(),
183+
elementDeal.replace('.dplayer-subtitle-icon', publicIcons.openDanmu))
184+
: ((showDanmaku = !1),
185+
player.danmaku.hide(),
186+
elementDeal.replace('.dplayer-subtitle-icon', publicIcons.closeDanmu)),
187+
player.user.set('danmaku', showDanmaku ? 1 : 0);
174188
};
175189

176190
const handlePipClick = () => {
@@ -186,6 +200,8 @@ const create = (options: any): any => {
186200

187201
const pipButton = document.querySelector('.dplayer-pip-icon');
188202
if (pipButton) pipButton.addEventListener('click', handlePipClick);
203+
const danmuButton = document.querySelector('.dplayer-subtitle-icon');
204+
if (danmuButton) danmuButton.addEventListener('click', handleDanmuClick);
189205
return player;
190206
};
191207

0 commit comments

Comments
 (0)