From bea27ee1e46adcf1fb02333a22b2581a1b22b76b Mon Sep 17 00:00:00 2001 From: gemstone Date: Tue, 1 Aug 2023 14:44:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20(xgplayer-dash)=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DDash=E5=BC=80=E6=92=AD=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20fixed=20#1002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fixtures/dash/index.html | 19 +++++++++++++++++++ fixtures/dash/index.js | 14 ++++++++++++++ fixtures/hls/index.js | 8 +++----- fixtures/xgplayer/index.js | 17 +++++++++++++++-- package.json | 3 +-- packages/xgplayer-dash/src/error.js | 2 +- packages/xgplayer-dash/src/m4s/xml2json.js | 2 +- 7 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 fixtures/dash/index.html create mode 100644 fixtures/dash/index.js diff --git a/fixtures/dash/index.html b/fixtures/dash/index.html new file mode 100644 index 00000000..b35b80fc --- /dev/null +++ b/fixtures/dash/index.html @@ -0,0 +1,19 @@ + + + + + + + 播放器 + + + + +
+ + + diff --git a/fixtures/dash/index.js b/fixtures/dash/index.js new file mode 100644 index 00000000..79f0c0fa --- /dev/null +++ b/fixtures/dash/index.js @@ -0,0 +1,14 @@ +import Player from '../../packages/xgplayer/src' +import DashPlugin from '../../packages/xgplayer-dash/src' + +new Player({ + id: 'mse', + url: 'https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd', + dashOpts: { + drm: { + } + }, + height: window.innerHeight, + width: window.innerWidth, + plugins: [DashPlugin] +}); diff --git a/fixtures/hls/index.js b/fixtures/hls/index.js index 70c52b8e..ab26b7a0 100644 --- a/fixtures/hls/index.js +++ b/fixtures/hls/index.js @@ -120,15 +120,13 @@ window.onload = function () { function pushEvent(name, value, container) { container = container || dlEvent - console.debug('[test]', name, value) + // console.debug('[test]', name, value) if (container === dlEvent && logFilter && !logFilter(name, value)) { return } - if (name === 'core.metadataparsed') { - if (value.track?.samples?.length > 100) { - return { '_': '数据过大,请查看devtools' } - } + if (name === 'core.metadataparsed' || name === 'core.demuxedtrack') { + return { '_': '数据过大,请查看devtools' } } try { value = JSON.stringify(value) diff --git a/fixtures/xgplayer/index.js b/fixtures/xgplayer/index.js index bdcee2e2..4ae3fee5 100644 --- a/fixtures/xgplayer/index.js +++ b/fixtures/xgplayer/index.js @@ -37,8 +37,18 @@ function init(index = 0, config = {}) { } window[p] = new Player({ id: 'video' + index, - url: '//www.douyin.com/aweme/v1/play/?video_id=v0200fg10000cirt32rc77u91a693ek0&line=0&file_id=a0646de047fa4533b552940e7b6685f4&sign=212796f782a906dc43d7f8d067bb6c39&is_play_url=1&source=PackSourceEnum_SEARCH&aid=6383', - DynamicBg: { + url: [ + { + "src": "//v3-web.douyinvod.com/8f1282bd3ebc6627fe6edd11ab7ab21e/649a9de1/video/tos/cn/tos-cn-ve-152c001-alinc2/owOAiQsiiMCFogZQIPAB1QZCmAEvvMVnSI2zJ/?a=6383&ch=5&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1233&bt=1233&cs=0&ds=4&ft=GN7rKGVVywIiRZm8Zmo~xj7ScoAppB996vrKktfDfto0g3&mime_type=video_mp4&qs=0&rc=ZGZkaGY8NTQ3ZTs4M2Q6NEBpajozN285cmx1bDMzNGkzM0BhLzRhNmItNWAxNDNgLjJeYSNeMi00MmRrM2BgLS1kLS9zcw%3D%3D&l=2023062715280030A46D62A1944C09A04F&btag=e00028000" + }, + { + "src": "//v26-web.douyinvod.com/4d55158b93f09f1ac4d86b66bb42cc4e/649a9de1/video/tos/cn/tos-cn-ve-152c001-alinc2/owOAiQsiiMCFogZQIPAB1QZCmAEvvMVnSI2zJ/?a=6383&ch=5&cr=3&dr=0&lr=all&cd=0%7C0%7C0%7C3&cv=1&br=1233&bt=1233&cs=0&ds=4&ft=GN7rKGVVywIiRZm8Zmo~xj7ScoAppB996vrKktfDfto0g3&mime_type=video_mp4&qs=0&rc=ZGZkaGY8NTQ3ZTs4M2Q6NEBpajozN285cmx1bDMzNGkzM0BhLzRhNmItNWAxNDNgLjJeYSNeMi00MmRrM2BgLS1kLS9zcw%3D%3D&l=2023062715280030A46D62A1944C09A04F&btag=e00028000" + }, + { + "src": "//www.douyin.com/aweme/v1/play/?video_id=v0200fg10000cicr6inog65l740057ag&line=0&file_id=a1571ac065784bc48102e99cde7a2cda&sign=05b1511ce3feee7ed6c65a84ad9be301&is_play_url=1&source=PackSourceEnum_FEED&aid=6383" + } + ], + DynamicBg: { disable: false }, marginControls: false, @@ -67,6 +77,9 @@ function init(index = 0, config = {}) { volume: { position: 'rootTop' }, + rotate: { + innerRotate: false + }, mobile: { // gestureX: false }, diff --git a/package.json b/package.json index 12b547f4..04fb13fd 100755 --- a/package.json +++ b/package.json @@ -11,9 +11,8 @@ "dev:flv": "yarn libd dev fixtures/flv", "dev:flvjs": "yarn libd dev fixtures/flvjs", "dev:mp4": "yarn libd dev fixtures/mp4", + "dev:dash": "yarn libd dev fixtures/dash", "dev:music": "yarn libd dev fixtures/music", - "dev:pano": "yarn libd dev fixtures/pano", - "dev:vr": "yarn libd dev fixtures/vr", "dev:subtitle": "yarn libd dev fixtures/subtitle", "build": "yarn libd build", "build:all": "yarn libd build -a", diff --git a/packages/xgplayer-dash/src/error.js b/packages/xgplayer-dash/src/error.js index be48359a..b25c2713 100755 --- a/packages/xgplayer-dash/src/error.js +++ b/packages/xgplayer-dash/src/error.js @@ -1,6 +1,6 @@ /* eslint-disable no-undef */ import { Errors } from 'xgplayer' -const version = JSON.parse('__XGPLAYER_DASH__') +import { version } from '../package.json' console.log('version', version) class _Errors extends Errors { constructor (type, vid, errd = {}, url = '') { diff --git a/packages/xgplayer-dash/src/m4s/xml2json.js b/packages/xgplayer-dash/src/m4s/xml2json.js index d5049597..b83d8440 100644 --- a/packages/xgplayer-dash/src/m4s/xml2json.js +++ b/packages/xgplayer-dash/src/m4s/xml2json.js @@ -50,7 +50,7 @@ export default class Xml2Json { if (child.nodeType !== Node.COMMENT_NODE) { const childPath = path + '.' + childName result.__cnt++ - if (result[childName] === null || result[childName] !== undefined) { + if (result[childName] === null || result[childName] === undefined) { const c = Xml2Json.parseDOMChildren(child, childPath) if (childName !== '#text' || /[^\s]/.test(c)) { const o = {}