mirror of
https://github.com/bytedance/xgplayer.git
synced 2025-04-05 03:05:02 +08:00
fix: 🐛 (xgplayer-dash) 修复Dash开播失败问题 fixed #1002
This commit is contained in:
parent
ed6ba11db4
commit
bea27ee1e4
19
fixtures/dash/index.html
Normal file
19
fixtures/dash/index.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<title>播放器</title>
|
||||
<style type="text/css">
|
||||
html, body {width:100%;height:100%;margin:auto;overflow: hidden;}
|
||||
body {display:flex;}
|
||||
#mse {flex:auto;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://unpkg.byted-static.com/xgplayer/3.0.1/dist/index.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="mse"></div>
|
||||
<script type="module" src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
14
fixtures/dash/index.js
Normal file
14
fixtures/dash/index.js
Normal file
@ -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]
|
||||
});
|
@ -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)
|
||||
|
@ -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
|
||||
},
|
||||
|
@ -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",
|
||||
|
@ -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 = '') {
|
||||
|
@ -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 = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user