Skip to content

Commit 2b208f8

Browse files
authored
Merge branch 'main' into feat_mseinworker
2 parents c2f0df4 + a29fa79 commit 2b208f8

File tree

21 files changed

+99
-54
lines changed

21 files changed

+99
-54
lines changed

packages/xgplayer-ads/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-ads",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"main": "dist/index.min.js",
55
"module": "es/index.js",
66
"typings": "es/index.d.ts",
@@ -15,7 +15,7 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"license": "MIT",
2121
"unpkgFiles": [
@@ -24,10 +24,10 @@
2424
"dependencies": {
2525
"can-autoplay": "^3.0.2",
2626
"eventemitter3": "^4.0.7",
27-
"xgplayer-streaming-shared": "3.0.22"
27+
"xgplayer-streaming-shared": "3.0.23-rc.2"
2828
},
2929
"peerDependencies": {
3030
"core-js": ">=3.12.1",
31-
"xgplayer": "3.0.22"
31+
"xgplayer": "3.0.23-rc.2"
3232
}
3333
}

packages/xgplayer-ads/src/ui/adUIManager.js

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export class AdUIManager {
6464
player.registerPlugin(decoratorClass)
6565
newDecoratorPlugin = player.getPlugin(decoratorClass.pluginName)
6666
fragment.appendChild(newDecoratorPlugin.root)
67+
if (newDecoratorPlugin.extraEls?.length) {
68+
newDecoratorPlugin.extraEls.forEach(el => {
69+
fragment.appendChild(el)
70+
})
71+
}
6772
}
6873

6974
adUIPlugins.push([
@@ -133,11 +138,26 @@ export class AdUIManager {
133138
if (!overrideAdPlugin) {
134139
return
135140
}
136-
const { root: adRoot } = overrideAdPlugin
137-
const { root: normalRoot } = normalPlugin
141+
const { root: adRoot, extraEls: adExtraEls } = overrideAdPlugin
142+
const { root: normalRoot, extraEls: normalExtraEls } = normalPlugin
138143
if (fragmentContainer.contains(adRoot)) {
139144
fragmentContainer.removeChild(adRoot)
140145
}
146+
// handle extra elements except root
147+
if (Array.isArray(adExtraEls) && adExtraEls.length) {
148+
adExtraEls.forEach((adEl, index) => {
149+
if (fragmentContainer.contains(adEl)) {
150+
fragmentContainer.removeChild(adEl)
151+
}
152+
const normalEl = normalExtraEls?.[index]
153+
if (normalEl?.parentNode) {
154+
// show ad extra dom
155+
normalEl.parentNode.insertBefore(adEl,normalEl)
156+
// hide normal extra dom
157+
fragmentContainer.appendChild(normalEl)
158+
}
159+
})
160+
}
141161
// The ad plugin and the target plugin swap positions
142162
normalRoot.parentNode.insertBefore(adRoot, normalRoot)
143163
fragmentContainer.appendChild(normalRoot)
@@ -180,15 +200,30 @@ export class AdUIManager {
180200
if (!overrideAdPlugin) {
181201
return
182202
}
183-
const { root: adRoot } = overrideAdPlugin
184-
const { root: normalRoot } = normalPlugin
203+
const { root: adRoot, extraEls: adExtraEl } = overrideAdPlugin
204+
const { root: normalRoot, extraEls: normalExtraEl } = normalPlugin
185205
if (fragmentContainer.contains(normalRoot)) {
186206
fragmentContainer.removeChild(normalRoot)
187207
}
188208
if (!fragmentContainer.contains(adRoot)) {
189209
adRoot.parentNode.insertBefore(normalRoot, adRoot)
190210
fragmentContainer.appendChild(adRoot)
191211
}
212+
// handle extra elements except root
213+
if (Array.isArray(normalExtraEl) && normalExtraEl?.length) {
214+
normalExtraEl.forEach((normalEl, index) => {
215+
if (fragmentContainer.contains(normalEl)) {
216+
fragmentContainer.removeChild(normalEl)
217+
}
218+
const adEl = adExtraEl?.[index]
219+
if (adEl && adEl.parentNode) {
220+
// show normal extra dom
221+
adEl.parentNode.insertBefore(normalEl, adEl)
222+
// hide ad extra dom
223+
fragmentContainer.appendChild(adEl)
224+
}
225+
})
226+
}
192227
})
193228

194229
// Non-Ad UI Plugins

packages/xgplayer-dash-live/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-dash-live",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"main": "dist/index.min.js",
55
"module": "es/index.js",
66
"typings": "es/index.d.ts",
@@ -15,7 +15,7 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"license": "MIT",
2121
"unpkgFiles": [

packages/xgplayer-dash/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-dash",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"description": "xgplayer plugin for MPEG-DASH",
55
"main": "dist/index.min.js",
66
"module": "es/index.js",
@@ -16,7 +16,7 @@
1616
"publishConfig": {
1717
"registry": "https://registry.npmjs.org/",
1818
"access": "public",
19-
"tag": "latest"
19+
"tag": "rc"
2020
},
2121
"repository": {
2222
"type": "git",
@@ -38,7 +38,7 @@
3838
"eventemitter3": "^4.0.7"
3939
},
4040
"peerDependencies": {
41-
"xgplayer": "3.0.22",
41+
"xgplayer": "3.0.23-rc.2",
4242
"core-js": ">=3.12.1"
4343
}
4444
}

packages/xgplayer-flv.js/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-flv.js",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"description": "web video player",
55
"main": "dist/index.min.js",
66
"module": "es/index.js",
@@ -15,7 +15,7 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"repository": {
2121
"type": "git",
@@ -37,6 +37,6 @@
3737
},
3838
"peerDependencies": {
3939
"core-js": ">=3.12.1",
40-
"xgplayer": "3.0.22"
40+
"xgplayer": "3.0.23-rc.2"
4141
}
4242
}

packages/xgplayer-flv/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-flv",
3-
"version": "3.0.23-beta.5",
3+
"version": "3.0.23-rc.2",
44
"main": "dist/index.min.js",
55
"module": "es/index.js",
66
"typings": "es/index.d.ts",
@@ -15,16 +15,16 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"license": "MIT",
2121
"unpkgFiles": [
2222
"dist"
2323
],
2424
"dependencies": {
2525
"eventemitter3": "^4.0.7",
26-
"xgplayer-transmuxer": "3.0.22",
27-
"xgplayer-streaming-shared": "3.0.22"
26+
"xgplayer-transmuxer": "3.0.23-rc.2",
27+
"xgplayer-streaming-shared": "3.0.23-rc.2"
2828
},
2929
"peerDependencies": {
3030
"xgplayer": ">=3.0.1",

packages/xgplayer-hls.js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-hls.js",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"description": "xgplayer plugin for hls",
55
"main": "dist/index.min.js",
66
"module": "es/index.js",
@@ -15,7 +15,7 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"repository": {
2121
"type": "git",

packages/xgplayer-hls/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-hls",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"main": "dist/index.min.js",
55
"module": "es/index.js",
66
"typings": "es/index.d.ts",
@@ -15,19 +15,19 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"license": "MIT",
2121
"unpkgFiles": [
2222
"dist"
2323
],
2424
"dependencies": {
2525
"eventemitter3": "^4.0.7",
26-
"xgplayer-transmuxer": "3.0.22",
27-
"xgplayer-streaming-shared": "3.0.22"
26+
"xgplayer-transmuxer": "3.0.23-rc.2",
27+
"xgplayer-streaming-shared": "3.0.23-rc.2"
2828
},
2929
"peerDependencies": {
30-
"xgplayer": "3.0.22",
30+
"xgplayer": "3.0.23-rc.2",
3131
"core-js": ">=3.12.1"
3232
}
3333
}

packages/xgplayer-mp4-loader/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-mp4-loader",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"main": "dist/index.min.js",
55
"module": "es/index.js",
66
"typings": "es/index.d.ts",
@@ -15,15 +15,15 @@
1515
"publishConfig": {
1616
"registry": "https://registry.npmjs.org/",
1717
"access": "public",
18-
"tag": "latest"
18+
"tag": "rc"
1919
},
2020
"license": "MIT",
2121
"unpkgFiles": [
2222
"dist"
2323
],
2424
"dependencies": {
25-
"xgplayer-transmuxer": "3.0.22",
26-
"xgplayer-streaming-shared": "3.0.22",
25+
"xgplayer-transmuxer": "3.0.23-rc.2",
26+
"xgplayer-streaming-shared": "3.0.23-rc.2",
2727
"eventemitter3": "^4.0.7"
2828
},
2929
"peerDependencies": {

packages/xgplayer-mp4/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xgplayer-mp4",
3-
"version": "3.0.22",
3+
"version": "3.0.23-rc.2",
44
"description": "xgplayer plugin for mp4 transform to fmp4",
55
"main": "dist/index.min.js",
66
"module": "es/index.js",
@@ -18,7 +18,7 @@
1818
"publishConfig": {
1919
"registry": "https://registry.npmjs.org/",
2020
"access": "public",
21-
"tag": "latest"
21+
"tag": "rc"
2222
},
2323
"repository": {
2424
"type": "git",
@@ -39,9 +39,9 @@
3939
"concat-typed-array": "^1.0.2",
4040
"deepmerge": "^2.0.1",
4141
"eventemitter3": "^4.0.7",
42-
"xgplayer-mp4-loader": "3.0.22",
43-
"xgplayer-streaming-shared": "3.0.22",
44-
"xgplayer-transmuxer": "3.0.22"
42+
"xgplayer-mp4-loader": "3.0.23-rc.2",
43+
"xgplayer-streaming-shared": "3.0.23-rc.2",
44+
"xgplayer-transmuxer": "3.0.23-rc.2"
4545
},
4646
"peerDependencies": {
4747
"xgplayer": ">=3.0.0",

0 commit comments

Comments
 (0)