Files
damai-wx/subPackages/video/wx-youkuplayer/index.js
MagicalKudzu f67fb8b6b3 更新
2025-12-17 14:19:22 +08:00

1945 lines
84 KiB
JavaScript

require('../../sub-vendors.js'),
(wx.webpackJsonp = wx.webpackJsonp || []).push([
[9818],
{
3609: function (t, e, i) {
var r = i(9476),
a = i(2573),
s = i.n(a),
n = i(3919).window
!(function (t) {
var e = {}
function i(r) {
if (e[r]) return e[r].exports
var a = (e[r] = { i: r, l: !1, exports: {} })
return t[r].call(a.exports, a, a.exports, i), (a.l = !0), a.exports
}
;(i.m = t),
(i.c = e),
(i.d = function (t, e, r) {
i.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r })
}),
(i.r = function (t) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(t, '__esModule', { value: !0 })
}),
(i.t = function (t, e) {
if ((1 & e && (t = i(t)), 8 & e)) return t
if (4 & e && 'object' === (0, r.A)(t) && t && t.__esModule) return t
var a = Object.create(null)
if (
(i.r(a),
Object.defineProperty(a, 'default', { enumerable: !0, value: t }),
2 & e && 'string' != typeof t)
)
for (var s in t)
i.d(
a,
s,
function (e) {
return t[e]
}.bind(null, s),
)
return a
}),
(i.n = function (t) {
var e =
t && t.__esModule
? function () {
return t.default
}
: function () {
return t
}
return i.d(e, 'a', e), e
}),
(i.o = function (t, e) {
return Object.prototype.hasOwnProperty.call(t, e)
}),
(i.p = ''),
i((i.s = 6))
})([
function (t, e, i) {
e.__esModule = !0
;(e.DefaultVideoData = {
id: 0,
encodeId: '',
title: '',
duration: 0,
videoType: '',
isShareAd: !1,
isDanmaku: !1,
isPanorama: !1,
isFee: !1,
isChannelVip: !1,
isSubscribe: !1,
isRtmp: !1,
isTrial: !1,
isVertical: !1,
categoryId: 0,
categoryLetterId: '',
categoryString: '',
tags: [],
coverURL: '',
}),
(e.DefaultWaterMark = { logo: {}, license: {}, register: {} }),
(e.DefaultTrialData = { type: '', time: 0, note: '' }),
(e.DefaultSegmentData = { seconds: 0, index: -1, size: 0, src: '', backupURL: '' }),
(e.DefaultPlayListData = {
upsData: null,
userData: null,
errorData: null,
videoData: null,
watermark: null,
showData: null,
trialData: null,
nextVideo: null,
isError: !1,
})
},
function (t, e, i) {
e.__esModule = !0
var r = {
defineGetter: function (t, e) {
Object.defineProperty(t, e, {
get: function () {
return t['_' + e]
},
})
},
}
e.default = r
},
function (t, e, i) {
e.__esModule = !0
;(e.PlayerStatusEvent = {
PLAYER_IS_READY: 'Player.Is.Ready',
PLAYER_IS_PAUSED: 'Player.Is.Paused',
PLAYER_IS_PLAYING: 'Player.Is.Playing',
PLAYER_PLAY_START: 'Player.Play.Start',
PLAYER_BUFFER_EMPTY: 'Player.Buffer.Empty',
PLAYER_PLAY_END: 'Player.Play.End',
PLAYER_PLAY_STOP: 'Player.Play.Stop',
PLAYER_DESTORY: 'Player.Destory',
PLAYER_PLAY_FAILED: 'Player.Play.Failed',
SERVICE_IS_DONE: 'Service.Is.Done',
PLAYER_FULL_SCREEN: 'Player.Full.Screen',
PLAYER_GOTO_LOGIN: 'Player.Goto.Login',
}),
(e.PlayerCommandEvent = {
START: 'start',
PLAY: 'play',
PAUSE: 'pause',
SEEK: 'seek',
REPLAY: 'replay',
RELOAD: 'reload',
RESTART: 'restart',
})
},
function (t, e, i) {
var a,
s =
'function' == typeof Symbol && 'symbol' === (0, r.A)(Symbol.iterator)
? function (t) {
return (0, r.A)(t)
}
: function (t) {
return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype
? 'symbol'
: (0, r.A)(t)
},
n = 'object' === ('undefined' == typeof Reflect ? 'undefined' : s(Reflect)) ? Reflect : null,
o =
n && 'function' == typeof n.apply
? n.apply
: function (t, e, i) {
return Function.prototype.apply.call(t, e, i)
}
a =
n && 'function' == typeof n.ownKeys
? n.ownKeys
: Object.getOwnPropertySymbols
? function (t) {
return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))
}
: function (t) {
return Object.getOwnPropertyNames(t)
}
var l =
Number.isNaN ||
function (t) {
return t != t
}
function u() {
u.init.call(this)
}
;(t.exports = u),
(u.EventEmitter = u),
(u.prototype._events = void 0),
(u.prototype._eventsCount = 0),
(u.prototype._maxListeners = void 0)
var h = 10
function c(t) {
return void 0 === t._maxListeners ? u.defaultMaxListeners : t._maxListeners
}
function p(t, e, i, r) {
var a, n, o
if ('function' != typeof i)
throw new TypeError(
'The "listener" argument must be of type Function. Received type ' +
(void 0 === i ? 'undefined' : s(i)),
)
if (
(void 0 === (n = t._events)
? ((n = t._events = Object.create(null)), (t._eventsCount = 0))
: (void 0 !== n.newListener &&
(t.emit('newListener', e, i.listener ? i.listener : i), (n = t._events)),
(o = n[e])),
void 0 === o)
)
(o = n[e] = i), ++t._eventsCount
else if (
('function' == typeof o ? (o = n[e] = r ? [i, o] : [o, i]) : r ? o.unshift(i) : o.push(i),
(a = c(t)) > 0 && o.length > a && !o.warned)
) {
o.warned = !0
var l = new Error(
'Possible EventEmitter memory leak detected. ' +
o.length +
' ' +
String(e) +
' listeners added. Use emitter.setMaxListeners() to increase limit',
)
;(l.name = 'MaxListenersExceededWarning'),
(l.emitter = t),
(l.type = e),
(l.count = o.length),
console && console.warn
}
return t
}
function d() {
for (var t = [], e = 0; e < arguments.length; e++) t.push(arguments[e])
this.fired ||
(this.target.removeListener(this.type, this.wrapFn),
(this.fired = !0),
o(this.listener, this.target, t))
}
function f(t, e, i) {
var r = { fired: !1, wrapFn: void 0, target: t, type: e, listener: i },
a = d.bind(r)
return (a.listener = i), (r.wrapFn = a), a
}
function y(t, e, i) {
var r = t._events
if (void 0 === r) return []
var a = r[e]
return void 0 === a
? []
: 'function' == typeof a
? i
? [a.listener || a]
: [a]
: i
? (function (t) {
for (var e = new Array(t.length), i = 0; i < e.length; ++i) e[i] = t[i].listener || t[i]
return e
})(a)
: m(a, a.length)
}
function _(t) {
var e = this._events
if (void 0 !== e) {
var i = e[t]
if ('function' == typeof i) return 1
if (void 0 !== i) return i.length
}
return 0
}
function m(t, e) {
for (var i = new Array(e), r = 0; r < e; ++r) i[r] = t[r]
return i
}
Object.defineProperty(u, 'defaultMaxListeners', {
enumerable: !0,
get: function () {
return h
},
set: function (t) {
if ('number' != typeof t || t < 0 || l(t))
throw new RangeError(
'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' +
t +
'.',
)
h = t
},
}),
(u.init = function () {
;(void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events) ||
((this._events = Object.create(null)), (this._eventsCount = 0)),
(this._maxListeners = this._maxListeners || void 0)
}),
(u.prototype.setMaxListeners = function (t) {
if ('number' != typeof t || t < 0 || l(t))
throw new RangeError(
'The value of "n" is out of range. It must be a non-negative number. Received ' + t + '.',
)
return (this._maxListeners = t), this
}),
(u.prototype.getMaxListeners = function () {
return c(this)
}),
(u.prototype.emit = function (t) {
for (var e = [], i = 1; i < arguments.length; i++) e.push(arguments[i])
var r = 'error' === t,
a = this._events
if (void 0 !== a) r = r && void 0 === a.error
else if (!r) return !1
if (r) {
var s
if ((e.length > 0 && (s = e[0]), s instanceof Error)) throw s
var n = new Error('Unhandled error.' + (s ? ' (' + s.message + ')' : ''))
throw ((n.context = s), n)
}
var l = a[t]
if (void 0 === l) return !1
if ('function' == typeof l) o(l, this, e)
else {
var u = l.length,
h = m(l, u)
for (i = 0; i < u; ++i) o(h[i], this, e)
}
return !0
}),
(u.prototype.addListener = function (t, e) {
return p(this, t, e, !1)
}),
(u.prototype.on = u.prototype.addListener),
(u.prototype.prependListener = function (t, e) {
return p(this, t, e, !0)
}),
(u.prototype.once = function (t, e) {
if ('function' != typeof e)
throw new TypeError(
'The "listener" argument must be of type Function. Received type ' +
(void 0 === e ? 'undefined' : s(e)),
)
return this.on(t, f(this, t, e)), this
}),
(u.prototype.prependOnceListener = function (t, e) {
if ('function' != typeof e)
throw new TypeError(
'The "listener" argument must be of type Function. Received type ' +
(void 0 === e ? 'undefined' : s(e)),
)
return this.prependListener(t, f(this, t, e)), this
}),
(u.prototype.removeListener = function (t, e) {
var i, r, a, n, o
if ('function' != typeof e)
throw new TypeError(
'The "listener" argument must be of type Function. Received type ' +
(void 0 === e ? 'undefined' : s(e)),
)
if (void 0 === (r = this._events)) return this
if (void 0 === (i = r[t])) return this
if (i === e || i.listener === e)
0 == --this._eventsCount
? (this._events = Object.create(null))
: (delete r[t], r.removeListener && this.emit('removeListener', t, i.listener || e))
else if ('function' != typeof i) {
for (a = -1, n = i.length - 1; n >= 0; n--)
if (i[n] === e || i[n].listener === e) {
;(o = i[n].listener), (a = n)
break
}
if (a < 0) return this
0 === a
? i.shift()
: (function (t, e) {
for (; e + 1 < t.length; e++) t[e] = t[e + 1]
t.pop()
})(i, a),
1 === i.length && (r[t] = i[0]),
void 0 !== r.removeListener && this.emit('removeListener', t, o || e)
}
return this
}),
(u.prototype.off = u.prototype.removeListener),
(u.prototype.removeAllListeners = function (t) {
var e, i, r
if (void 0 === (i = this._events)) return this
if (void 0 === i.removeListener)
return (
0 === arguments.length
? ((this._events = Object.create(null)), (this._eventsCount = 0))
: void 0 !== i[t] &&
(0 == --this._eventsCount ? (this._events = Object.create(null)) : delete i[t]),
this
)
if (0 === arguments.length) {
var a,
s = Object.keys(i)
for (r = 0; r < s.length; ++r) 'removeListener' !== (a = s[r]) && this.removeAllListeners(a)
return (
this.removeAllListeners('removeListener'),
(this._events = Object.create(null)),
(this._eventsCount = 0),
this
)
}
if ('function' == typeof (e = i[t])) this.removeListener(t, e)
else if (void 0 !== e) for (r = e.length - 1; r >= 0; r--) this.removeListener(t, e[r])
return this
}),
(u.prototype.listeners = function (t) {
return y(this, t, !0)
}),
(u.prototype.rawListeners = function (t) {
return y(this, t, !1)
}),
(u.listenerCount = function (t, e) {
return 'function' == typeof t.listenerCount ? t.listenerCount(e) : _.call(t, e)
}),
(u.prototype.listenerCount = _),
(u.prototype.eventNames = function () {
return this._eventsCount > 0 ? a(this._events) : []
})
},
function (t, e, i) {
e.__esModule = !0
var r = (function () {
function t(t, e) {
for (var i = 0; i < e.length; i++) {
var r = e[i]
;(r.enumerable = r.enumerable || !1),
(r.configurable = !0),
'value' in r && (r.writable = !0),
Object.defineProperty(t, r.key, r)
}
}
return function (e, i, r) {
return i && t(e.prototype, i), r && t(e, r), e
}
})()
!(function (t) {
t && t.__esModule
})(i(9))
var a = (function () {
function t(e) {
;(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
(this.config = e),
(this._logHost = 'https://gm.mmstat.com/yt/vx/'),
(this._logName = ''),
(this._id = 'youkulog'),
(this._enabled = !0)
}
return (
(t.prototype.formatParams = function (t) {
var e = []
for (var i in t) 'aplus' === i ? e.push(i) : e.push(i + '=' + encodeURIComponent(t[i]))
return e.join('&')
}),
(t.prototype.onNetStatus = function (t) {
if (!this.enabled) return !1
}),
(t.prototype.getParams = function () {
return {}
}),
(t.prototype.processEnabledChange = function () {}),
(t.prototype.report = function () {
if (this._enabled) {
var t = this.getParams()
this._config && Object.assign(t, this._config)
var e = this._logHost + this._logName + '?' + this.formatParams(t)
s().request({ url: e })
}
}),
r(t, [
{
key: 'id',
get: function () {
return this._id
},
set: function (t) {
this._id = t
},
},
{
key: 'config',
set: function (t) {
this._config = t
},
},
{
key: 'enabled',
get: function () {
return this._enabled
},
set: function (t) {
;(this._enabled = t), this.processEnabledChange()
},
},
]),
t
)
})()
e.default = a
},
,
function (t, e, i) {
var r = l(i(7)),
a = l(i(12)),
n = i(2),
o = l(i(19))
function l(t) {
return t && t.__esModule ? t : { default: t }
}
Component({
properties: {
ccode: { type: String, value: '0517' },
utid: { type: String, value: 'eWrCEmi2cFsCAWoLI41wnWhW' },
playerId: { type: String, value: 'youku-player' },
vid: {
type: String,
observer: function (t) {
this.setVid(t)
},
},
showid: {
type: String,
observer: function (t) {
this.setShowid(t)
},
},
allowRecord: { type: Boolean, value: !0 },
supportType: { type: String, value: 'hls' },
coverURL: { type: String },
streamURL: {
type: String,
value: '',
observer: function (t) {
this.setStreamURL(t)
},
},
isLogin: { type: Boolean, value: !1 },
},
data: {
isShowLayer: !1,
panelName: '',
isError: !1,
errorMessage: '',
openAppParam: '',
isVertical: !1,
logo: '',
logoStyle: '',
fullLogo: '',
fullLogoStyle: '',
initialTime: 0,
},
attached: function () {
var t = this
;(this.currectStream = {}),
(this.autoplay = !0),
(this.retryCount = 0),
(this.playlistData = null),
(this.playTimer = null),
(this.isFirstUpdate = !1),
(this.vidNum = 0),
(this.startTime = 0),
(this.networkType = ''),
(this.historyService = new o.default()),
(this._log = new r.default({ ccode: this.data.ccode, utid: this.data.utid })),
(this._service = new a.default()),
(this.videoContext = s().createVideoContext(this.data.playerId, this)),
s().getNetworkType({
complete: function (e) {
e.networkType ? (t.networkType = e.networkType) : (t.networkType = 'none'),
(t.autoplay = !0),
'none' !== t.networkType && 'wifi' !== t.networkType && (t.autoplay = !1),
(t.isReady = !0),
t.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_IS_READY,
data: { playerId: t.data.playerId },
}),
t.reset()
},
}),
s().onNetworkStatusChange(function (e) {
t.networkType = e.networkType
})
},
pageLifetimes: { show: function () {}, hide: function () {} },
methods: {
onLayerEvent: function (t) {
switch (t.detail) {
case 'GOTO_LOGIN':
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_GOTO_LOGIN,
data: { playerId: this.data.playerId },
})
break
case 'PLAYER_REPLAY':
this.replay()
break
case 'PLAYER_REFRASH':
this.isError
? this.vid || this.showid
? this.reset()
: this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_PLAY_FAILED,
data: { playerId: this.data.playerId, message: 'player no vid OR showid' },
})
: this.replay()
break
case 'PLAYER_PLAY':
;(this.autoplay = !0), this.data.streamURL && this.play()
}
},
onPlayHandler: function () {},
onPauseHandler: function () {
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_IS_PAUSED,
data: { playerId: this.data.playerId },
}),
this._log.onNetStatus({
code: n.PlayerStatusEvent.PLAYER_IS_PAUSED,
data: { playerId: this.data.playerId },
})
},
onBufferHandler: function () {
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_BUFFER_EMPTY,
data: { playerId: this.data.playerId },
}),
this._log.onNetStatus({
code: n.PlayerStatusEvent.PLAYER_BUFFER_EMPTY,
data: { playerId: this.data.playerId },
})
},
onErrorHandler: function (t) {
var e = this
wx.getSystemInfo({
success: function (t) {
if (-1 === t.system.indexOf('iOS')) {
if (!e.data.streamURL) return
e.playTimer && clearTimeout(e.playTimer),
e.videoContext && e.videoContext.pause(),
e.retryCount++,
e.retryCount < 2 && 'hls' === e.data.supportType
? e.currectStream &&
e.currectStream.segs &&
e.currectStream.segs[0] &&
e.currectStream.segs[0].src &&
e.setData({ streamURL: e.currectStream.segs[0].src })
: (e.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_PLAY_FAILED,
data: { playerId: e.data.playerId },
}),
e._log.onNetStatus({
code: n.PlayerStatusEvent.PLAYER_PLAY_FAILED,
data: { playerId: e.data.playerId },
}),
e.showError())
}
},
})
},
onTimerHandler: function (t) {
this.data.streamURL &&
(this.isFirstUpdate
? (this.currentTime = t.detail.currentTime)
: ((this.isFirstUpdate = !0),
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_PLAY_START,
data: { playerId: this.data.playerId },
}),
this._log.onNetStatus({
code: n.PlayerStatusEvent.PLAYER_PLAY_START,
data: { playerId: this.data.playerId },
})),
this.data.allowRecord && this.historyService.updataRecodeTime(t.detail.currentTime, this.vidNum),
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_IS_PLAYING,
data: { time: t.detail.currentTime, playerId: this.data.playerId },
}),
this._log.onNetStatus({
code: n.PlayerStatusEvent.PLAYER_IS_PLAYING,
data: { time: t.detail.currentTime, playerId: this.data.playerId },
}))
},
onFullHandler: function (t) {
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_FULL_SCREEN,
data: { full: t.detail.fullScreen, playerId: this.data.playerId },
})
},
onEndHandler: function (t) {
var e = 'end'
this.playlistData &&
this.playlistData.videoData.isTrial &&
(e =
this.playlistData.videoData.isFee || this.playlistData.videoData.isChannelVip ? 'vip' : 'login'),
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_PLAY_END,
data: { status: e, playerId: this.data.playerId },
}),
this._log.onNetStatus({
code: n.PlayerStatusEvent.PLAYER_PLAY_END,
data: { status: e, playerId: this.data.playerId },
}),
this.setData({ panelName: e, isShowLayer: !0 })
},
setVid: function (t) {
'' !== t &&
this.isReady &&
(this.setData({ showid: '' }),
this._log.onNetStatus({ code: n.PlayerCommandEvent.RESTART }),
this.reset())
},
setShowid: function (t) {
'' !== t &&
this.isReady &&
(this.setData({ vid: '' }),
this._log.onNetStatus({ code: n.PlayerCommandEvent.RESTART }),
this.reset())
},
setStreamURL: function (t) {
this.autoplay && t && this.play(), this.setData({ initialTime: this.startTime })
},
_requestUps: function () {
var t = {}
;(t.ccode = this.data.ccode),
(t.utid = this.data.utid),
this.data.showid ? (t.showid = this.data.showid) : (t.vid = this.data.vid)
var e = { onSuccess: this.parseMeidaData.bind(this), onError: this.loadError.bind(this) }
this._service.start(t, e)
},
loadError: function (t) {
t.playlistData &&
((this.currectStream = null),
(this.playlistData = t.playlistData),
(this.vidNum = this.playlistData.videoData.id),
(this.coverURL = this.playlistData.videoData.coverURL)),
this.showError('error', t.errorMessage)
},
parseMeidaData: function (t) {
t.userData && t.userData.uid && !this.data.isLogin && this.setData({ isLogin: !0 }),
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.SERVICE_IS_DONE,
data: { playerId: this.data.playerId, upsdata: t },
}),
this._log.onNetStatus({ code: n.PlayerStatusEvent.SERVICE_IS_DONE, data: t }),
(this.playlistData = t),
(this.vidNum = this.playlistData.videoData.id),
(this.startTime = 0)
var e = void 0
if (this.data.allowRecord) {
var i = this.historyService.getCurrectVideo(this.playlistData.videoData.id)
i
? ((this.startTime = Number(i.currentTime)),
this.startTime > this.playlistData.videoData.duration - 10 &&
(this.startTime = this.playlistData.videoData.duration - 10))
: this.historyService.addHistory(t)
}
var r = this.playlistData.getMediaStreamData('mp4')
r &&
r[0] &&
((this.currectStream = this.playlistData.getStreamByQuality(r[0].id, '480p')),
(this.currectStream && this.currectStream.streamURL) || (this.currectStream = r[0].qualityList[0]),
this.currectStream &&
(!this.currectStream.hasLogo &&
this.playlistData.watermark.logo &&
this.playlistData.watermark.logo.logo &&
this.setData({
logo: this.playlistData.watermark.logo.logo,
logoStyle: this.playlistData.watermark.logo.logoStyle,
fullLogo: this.playlistData.watermark.logo.fullLogo,
fullLogoStyle: this.playlistData.watermark.logo.fullLogoStyle,
}),
'hls' === this.data.supportType && this.currectStream.streamURL
? (e = this.currectStream.streamURL)
: this.currectStream.segs &&
this.currectStream.segs[0] &&
this.currectStream.segs[0].src &&
(e = this.currectStream.segs[0].src))),
e
? this.setData({
streamURL: e,
coverURL: t.videoData.coverURL,
isVertical: t.videoData.isVertical,
})
: (this.setData({ coverURL: t.videoData.coverURL }), this.showError())
},
showError: function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'error',
e =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: '视频暂时无法播放,小酷正全力修复中,非常抱歉'
'4g' === t || 'init' === t || 'loading' === t
? (this.isError = !1)
: ((this.isError = !0),
'none' !== this.networkType &&
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_PLAY_FAILED,
data: { playerId: this.data.playerId, message: e },
})),
this.setData({ isShowLayer: !0, panelName: t, errorMessage: e })
},
reset: function () {
var t = 'loading'
switch (
(this.videoContext && this.videoContext.pause(),
this.playTimer && clearTimeout(this.playTimer),
this.networkType)
) {
case 'none':
t = 'nonetwork'
break
case 'wifi':
this.autoplay || (t = 'init')
break
default:
this.autoplay || (t = '4g')
}
;(this.isFirstUpdate = !1),
(this.retryCount = 0),
this.setData({ streamURL: '', logo: '', logoStyle: '', fullLogo: '', fullLogoStyle: '' }),
this.showError(t),
this.historyService && this.historyService.reset(),
(this.data.vid || this.data.showid) &&
(this.historyService && this.historyService.getHistoryList(), this._requestUps())
},
replay: function () {
var t = this
this._log && this._log.onNetStatus({ code: n.PlayerCommandEvent.REPLAY }),
(this.startTime = 0),
(this.isFirstUpdate = !1),
this.setData({ initialTime: this.startTime }),
this.videoContext && this.videoContext.seek(0),
this.playTimer && clearTimeout(this.playTimer),
this.data.isShowLayer && this.setData({ isShowLayer: !1 }),
(this.playTimer = setTimeout(function () {
t.videoContext && t.videoContext.play()
}, 1500))
},
play: function () {
var t = this
this.playTimer && clearTimeout(this.playTimer),
this.data.isShowLayer && this.setData({ isShowLayer: !1 }),
(this.playTimer = setTimeout(function () {
t.videoContext.play()
}, 1e3))
},
pause: function () {
this._log && this._log.onNetStatus({ code: n.PlayerStatusEvent.PLAYER_IS_PAUSED }),
this.videoContext && this.videoContext.pause()
},
stop: function () {
this.data.isShowLayer ||
(this._log.onNetStatus({ code: n.PlayerStatusEvent.PLAYER_PLAY_STOP }),
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_PLAY_STOP,
data: { playerId: this.data.playerId },
}),
this.videoContext && this.videoContext.pause(),
this.playTimer && clearTimeout(this.playTimer),
(this.startTime = this.currentTime),
(this.isFirstUpdate = !1),
this.setData({ initialTime: this.startTime }),
this.showError('init'))
},
destory: function () {
;(this.currectStream = null),
(this.playlistData = null),
this.setData({ vid: '', streamURL: '', panelName: '' }),
this.videoContext && this.videoContext.pause(),
this.playTimer && clearTimeout(this.playTimer),
this.triggerEvent('YoukuPlayerEvent', {
code: n.PlayerStatusEvent.PLAYER_DESTORY,
data: { playerId: this.data.playerId },
}),
this._log && this._log.onNetStatus({ code: n.PlayerStatusEvent.PLAYER_DESTORY })
},
},
})
},
function (t, e, i) {
e.__esModule = !0
var a = (function () {
function t(t, e) {
for (var i = 0; i < e.length; i++) {
var r = e[i]
;(r.enumerable = r.enumerable || !1),
(r.configurable = !0),
'value' in r && (r.writable = !0),
Object.defineProperty(t, r.key, r)
}
}
return function (e, i, r) {
return i && t(e.prototype, i), r && t(e, r), e
}
})(),
s = i(3),
n = l(i(8)),
o = l(i(10))
function l(t) {
return t && t.__esModule ? t : { default: t }
}
function u(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
return !e || ('object' !== (0, r.A)(e) && 'function' != typeof e) ? t : e
}
var h = (function (t) {
function e(i) {
!(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, e)
var r = u(this, t.call(this))
return (r._config = i), r._initialize(), r
}
return (
(function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Super expression must either be null or a function, not ' + (0, r.A)(e))
;(t.prototype = Object.create(e && e.prototype, {
constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 },
})),
e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : (t.__proto__ = e))
})(e, t),
(e.prototype.put = function (t) {
t && this._loggers.set(t.id, t)
}),
(e.prototype.remove = function (t) {
t && this._loggers.has(t.id) && this._loggers.delete(t.id)
}),
(e.prototype.onNetStatus = function (t) {
var e = this
this._loggers.forEach(function (i) {
'function' == typeof i.onNetStatus ? i.onNetStatus(t) : e._loggers.delete(i.id)
})
}),
(e.prototype._initialize = function () {
;(this._loggers = new Map()), this.init()
}),
(e.prototype.init = function () {
this.put(new n.default(this._config)), this.put(new o.default(this._config))
}),
(e.prototype.destory = function () {
t.prototype.destroy.call(this), this._loggers.clear()
}),
a(e, [
{
key: 'config',
set: function (t) {
;(this._config = t),
this._loggers.forEach(function (e) {
e.config = t
})
},
},
]),
e
)
})(s.EventEmitter)
e.default = h
},
function (t, e, i) {
e.__esModule = !0
var a = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(4)),
s = i(2)
function n(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
return !e || ('object' !== (0, r.A)(e) && 'function' != typeof e) ? t : e
}
var o = (function (t) {
function e(i) {
!(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, e)
var r = n(this, t.call(this, i))
return (r.id = 'vvlog'), (r._logName = 'youkuweixin.player.vdoview'), r._reset(), r
}
return (
(function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Super expression must either be null or a function, not ' + (0, r.A)(e))
;(t.prototype = Object.create(e && e.prototype, {
constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 },
})),
e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : (t.__proto__ = e))
})(e, t),
(e.prototype._resetParams = function () {
this._playlistData
? ((this._param.encodeId = this._playlistData.videoData.encodeId),
(this._param.vid = this._playlistData.videoData.id),
(this._param.vvid = this._playlistData.upsData.psid || ''),
(this._param.videotype = this._playlistData.videoData.videoType || ''),
(this._param.showcategory = this._playlistData.showData.showcategory || ''),
this._playlistData.userData.ytid
? (this._param.user_id = this._playlistData.userData.ytid)
: (this._param.user_id = this._playlistData.userData.uid))
: ((this._param.vid = ''),
(this._param.encodeId = ''),
(this._param.vvid = ''),
(this._param.user_id = 0))
}),
(e.prototype.onNetStatus = function (t) {
switch (t.code) {
case s.PlayerStatusEvent.PLAYER_PLAY_START:
if (!this._playlistData) return
this.report(), (this.enabled = !1)
break
case s.PlayerCommandEvent.RESTART:
case s.PlayerStatusEvent.PLAYER_DESTORY:
;(this._playlistData = null), this._reset()
break
case s.PlayerCommandEvent.REPLAY:
this._reset()
break
case s.PlayerStatusEvent.SERVICE_IS_DONE:
;(this._playlistData = t.data), this._resetParams()
}
}),
(e.prototype.getParams = function () {
return this._param
}),
(e.prototype._reset = function () {
;(this.enabled = !0), (this._param = {}), this._resetParams()
}),
e
)
})(a.default)
e.default = o
},
function (t, e, i) {
e.__esModule = !0
var r = {
rand: function (t, e) {
var i,
r = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''),
a = [],
s = 0
if (((e = e || r.length), t)) for (s = 0; s < t; s++) a[s] = r[0 | (Math.random() * e)]
else
for (a[8] = a[13] = a[18] = a[23] = '-', a[14] = '4', s = 0; s < 36; s++)
a[s] || ((i = 0 | (16 * Math.random())), (a[s] = r[19 === s ? (3 & i) | 8 : i]))
return a.join('')
},
}
e.default = r
},
function (t, e, i) {
e.__esModule = !0
var a = o(i(4)),
s = i(2),
n = o(i(11))
function o(t) {
return t && t.__esModule ? t : { default: t }
}
function l(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
return !e || ('object' !== (0, r.A)(e) && 'function' != typeof e) ? t : e
}
var u = (function (t) {
function e(i) {
!(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, e)
var r = l(this, t.call(this, i))
return (r.id = 'tslog'), (r._logName = 'youkuweixin.player.vtslog'), r.reset(), r
}
return (
(function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Super expression must either be null or a function, not ' + (0, r.A)(e))
;(t.prototype = Object.create(e && e.prototype, {
constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 },
})),
e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : (t.__proto__ = e))
})(e, t),
(e.prototype.onNetStatus = function (t) {
if (!this._enabled) return !1
switch (t.code) {
case s.PlayerStatusEvent.PLAYER_IS_PLAYING:
if (!this._playlistData) return
this._timer.getRunning() || this._timer.start()
break
case s.PlayerStatusEvent.PLAYER_PLAY_END:
if ((this._timer.getRunning() && this._timer.pause(), !this._playlistData)) return
;(this._param.playcomplete = '1'), this.report()
break
case s.PlayerCommandEvent.RESTART:
case s.PlayerStatusEvent.PLAYER_DESTORY:
;(this._playlistData = null), this.reset()
break
case s.PlayerCommandEvent.REPLAY:
this.reset()
break
case s.PlayerStatusEvent.SERVICE_IS_DONE:
;(this._playlistData = t.data), this._resetParams()
break
case s.PlayerStatusEvent.PLAYER_IS_PAUSED:
case s.PlayerStatusEvent.PLAYER_PLAY_STOP:
case s.PlayerStatusEvent.PLAYER_PLAY_FAILED:
this._timer.getRunning() && this._timer.pause()
}
}),
(e.prototype.reset = function () {
;(this._enabled = !0),
(this._param = {}),
(this._param.playcomplete = '0'),
(this._param.serialnumber = 0),
(this._param.playtime = 0),
(this._param.heartbeatInterval = 5),
(this._num = 0),
this._timer
? this._timer.reset()
: ((this._timer = new n.default(5e3)),
this._timer.addEventListener(n.default.TIMER, this._onTimer.bind(this))),
this._timer.pause(),
this._resetParams()
}),
(e.prototype.getParams = function () {
return this._param
}),
(e.prototype._resetParams = function () {
this._playlistData
? ((this._param.vid = this._playlistData.videoData.id),
(this._param.vvid = this._playlistData.upsData.psid || ''),
(this._param.videotype = this._playlistData.videoData.videoType || ''),
(this._param.showcategory = this._playlistData.showData.showcategory || ''),
this._playlistData.userData.ytid
? (this._param.user_id = this._playlistData.userData.ytid)
: (this._param.user_id = this._playlistData.userData.uid))
: ((this._param.vid = ''), (this._param.vvid = ''), (this._param.user_id = 0))
}),
(e.prototype._onTimer = function () {
this._checkTSLogTimes() && this.report()
}),
(e.prototype._signTS = function (t) {
if (!t) return 0
var e = 0,
i = void 0,
r = t.length
for (i = 0; i < r; i++) (e = 43 * e + t.charCodeAt(i)), (e %= 1e10)
return e
}),
(e.prototype._checkTSLogTimes = function () {
var t
return (
this._num++,
(this._param.playtime = 5 * this._num),
this._num <= 12
? (this._param.heartbeatInterval = 5)
: this._num <= 36
? (this._param.heartbeatInterval = 10)
: (this._param.heartbeatInterval = 20),
(t = this._param.playtime % this._param.heartbeatInterval == 0) && this._param.serialnumber++,
t
)
}),
e
)
})(a.default)
e.default = u
},
function (t, e, i) {
function a(t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
}
function s(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
return !e || ('object' !== (0, r.A)(e) && 'function' != typeof e) ? t : e
}
e.__esModule = !0
var o = (function (t) {
function e(i) {
var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1 / 0,
n = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]
a(this, e)
var o = s(this, t.call(this))
return (
(o.listeners = {}),
(o.milliseconds = 0),
(o.interval = i),
(o.repeat = o.repeatTracker = r),
(o.useTimeout = n),
(o.timeoutDelay = Math.round(i / 20)),
o
)
}
return (
(function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Super expression must either be null or a function, not ' + (0, r.A)(e))
;(t.prototype = Object.create(e && e.prototype, {
constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 },
})),
e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : (t.__proto__ = e))
})(e, t),
(e.prototype.getCurrentCount = function () {
return this.repeat - this.repeatTracker
}),
(e.prototype.getInterval = function () {
return this.interval
}),
(e.prototype.getMilliseconds = function () {
return this.milliseconds
}),
(e.prototype.getRepeatCount = function () {
return this.repeat
}),
(e.prototype.getRunning = function () {
return void 0 !== this.timer
}),
(e.prototype.addEventListener = function (t, e) {
this.addListener(t, e)
}),
(e.prototype.requestFrame = function (t) {
this.useTimeout ? (this.timeoutId = setTimeout(t, this.timeoutDelay)) : n.requestAnimationFrame(t)
}),
(e.prototype.animationFrame = function () {
var t = this
if (void 0 !== this.timer)
if (this.repeatTracker > 0) {
var e = new Date().getTime() - this.timer
e >= this.interval &&
((this.milliseconds += this.interval),
(this.timer = new Date().getTime() - (e - this.interval)),
this.repeatTracker--,
this.update()),
this.requestFrame(function () {
t.animationFrame()
})
} else this.complete()
}),
(e.prototype.complete = function () {
this.pause(), this.emit(e.TIMER_COMPLETE, { timer: this, timeRemaining: this.repeatTracker })
}),
(e.prototype.pause = function () {
this.useTimeout && clearTimeout(this.timeoutId), (this.timer = void 0)
}),
(e.prototype.reset = function () {
;(this.milliseconds = 0),
(this.repeatTracker = this.repeat),
this.emit(e.TIMER_RESET, {
timer: this,
timeRemaining: this.repeatTracker,
running: this.getRunning(),
})
}),
(e.prototype.removeEventListener = function (t, e) {
this.removeListener(t, e)
}),
(e.prototype.start = function () {
var t = this
void 0 === this.timer &&
((this.timer = new Date().getTime()),
this.requestFrame(function () {
t.animationFrame()
}))
}),
(e.prototype.update = function () {
this.emit(e.TIMER, { timer: this, timeRemaining: this.repeatTracker })
}),
e
)
})(i(3).EventEmitter)
;(o.TIMER = 'timer'),
(o.TIMER_COMPLETE = 'timer-complete'),
(o.TIMER_RESET = 'timer-reset'),
(e.default = o)
},
function (t, e, i) {
e.__esModule = !0
var r = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(13))
var a = [
'该视频小程序暂不支持。',
'出错啦,视频不存在,请看看其他视频吧',
'该视频小程序暂不支持。',
'抱歉,因版权原因无法观看此视频!',
],
n = (function () {
function t() {
;(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
(this.vid = ''),
(this._retryCount = 4)
}
return (
(t.prototype.start = function (t, e) {
;(t.vid || t.showid) &&
((this.callbacks = e),
(this.vid = t.vid || ''),
(this.ccode = t.ccode || '0517'),
(this.utid = t.utid || 'eWrCEmi2cFsCAWoLI41wnWhW'),
(this.showid = t.showid || ''),
(this._retryCount = 4),
this.requestData())
}),
(t.prototype.requestData = function () {
var t = this,
e = { url: 'https://ups.youku.com/ups/get.json' }
;(e.data = this.getServieceParam()),
(e.success = function (e) {
e.data && t.onComplete(e.data)
}),
(e.fail = function () {
t.dispatchError()
}),
s().request(e)
}),
(t.prototype.getServieceParam = function () {
var t = {}
return (
(t.vid = this.vid),
this.showid && (t.showid = this.showid),
(t.ccode = this.ccode),
(t.client_ip = '192.168.1.1'),
(t.utid = this.utid),
(t.client_ts = parseInt(new Date().getTime() / 1e3)),
t
)
}),
(t.prototype.onComplete = function (t) {
if (!t.hasOwnProperty('e') || !t.e.hasOwnProperty('code') || 0 !== t.e.code || !t.data)
return (
this._retryCount--,
void (this._retryCount < 1 || 1111 === t.status
? this._playListDataError({ errorCode: '22501' })
: this.requestData())
)
if (t.data.error && t.data.error.code < 0) {
var e = '',
i = [
['-1000', '-1001', '-1002', '-1003', ' -1004'],
[
'-2001',
'-2002',
'-2003',
'-2004',
'-2005',
'-3001',
'-3002',
'-3003',
'-3004',
'-3005',
'-3006',
'-3007',
'-3008',
'-3009',
'-4002',
'-4003',
'-4007',
],
['-4001'],
]
;-1 !==
[
'-3006',
'-4003',
'-4004',
'-4005',
'-4006',
'-5001',
'-6001',
'-6003',
'-6004',
'-6005',
'-6006',
].indexOf(String(t.data.error.code)) &&
(e = '23' + (e = String(t.data.error.code)).slice(1, 2) + e.slice(3, 5))
for (var s = 0, n = 0; n < i.length; n++)
-1 !== i[n].indexOf(String(t.data.error.code)) && (s = n + 1)
var o = new r.default(t.data),
l = a[s]
this._playListDataError({
playlistData: o,
errorCode: e,
errorMessage: l,
originCode: String(t.data.error.code),
})
} else {
var u = new r.default(t.data)
this.callbacks.onSuccess(u)
}
}),
(t.prototype._playListDataError = function (t) {
t.errorCode, t.errorMessage || (t.errorMessage = a[0]), this.callbacks.onError(t)
}),
(t.prototype.dispatchError = function () {
this._retryCount--,
this._retryCount < 1 ? this._playListDataError({ errorCode: '20404' }) : this.requestData()
}),
t
)
})()
e.default = n
},
function (t, e, i) {
e.__esModule = !0
var r = (function () {
function t(t, e) {
for (var i = 0; i < e.length; i++) {
var r = e[i]
;(r.enumerable = r.enumerable || !1),
(r.configurable = !0),
'value' in r && (r.writable = !0),
Object.defineProperty(t, r.key, r)
}
}
return function (e, i, r) {
return i && t(e.prototype, i), r && t(e, r), e
}
})(),
a = h(i(14)),
s = h(i(15)),
n = h(i(16)),
o = h(i(18)),
l = i(0),
u = h(i(1))
function h(t) {
return t && t.__esModule ? t : { default: t }
}
var c = (function () {
function t(e) {
if (
((function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
!e)
)
return null
for (var i in ((this._playlistData = e),
(this._upsData = e.ups || {}),
(this._userData = e.user || {}),
e.error && (this._isError = !0),
(this._errorData = e.error || {}),
(this._watermark = new o.default(e.watermark)),
(this._videoData = new a.default(e.video, e.trial, e.controller)),
e.videos && e.videos.next ? (this._nextVideo = e.videos.next) : (this._nextVideo = {}),
(this._showData = e.show || {}),
(this._trialData = new s.default(e.trial)),
(this._streamsData = new n.default(e.stream, e.dvd)),
l.DefaultPlayListData))
u.default.defineGetter(this, i)
}
return (
(t.prototype.getMediaStreamData = function () {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'flv'
return this._streamsData.getMediaStreamData(t)
}),
(t.prototype.getStreamByQuality = function (t, e) {
return this._streamsData.getStreamByQuality(t, e)
}),
r(t, [
{
key: 'playlistData',
get: function () {
return this._playlistData
},
},
{
key: 'streamsData',
get: function () {
return this._streamsData.streamData
},
},
]),
t
)
})()
e.default = c
},
function (t, e, i) {
e.__esModule = !0
var r = i(0),
a = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(1))
var s = (function () {
function t(e, i, s) {
for (var n in ((function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
r.DefaultVideoData))
(this['_' + n] = r.DefaultVideoData[n]), a.default.defineGetter(this, n)
e && this._resetVideoData(e, i, s)
}
return (
(t.prototype._resetVideoData = function (t, e, i) {
if (
(t.hasOwnProperty('id') && (this._id = t.id),
t.hasOwnProperty('encodeid') && (this._encodeId = t.encodeid),
t.hasOwnProperty('title') && (this._title = t.title),
t.hasOwnProperty('seconds') && (this._duration = t.seconds),
t.hasOwnProperty('ctype') && (this._videoType = t.ctype),
t.hasOwnProperty('logo') && (this._coverURL = t.logo),
t.hasOwnProperty('category_id') && (this._categoryId = t.category_id),
t.hasOwnProperty('category_letter_id') && (this._categoryLetterId = t.category_letter_id),
t.hasOwnProperty('subcategories'))
) {
var r = [],
a = void 0
for (a = 0; a < t.subcategories.length; a++)
t.subcategories[a].hasOwnProperty('id') && r.push(t.subcategories[a].id)
this._categoryString = r.join('|')
}
t.hasOwnProperty('tags') && (this._tags = t.tags), this._resetVideoTypeData(t, e, i)
}),
(t.prototype._resetVideoTypeData = function (t, e, i) {
if ((e && (this._isTrial = !0), e && t.hasOwnProperty('privacy'))) {
var r = 'subscribe' === e.type,
a = 'follower' === t.privacy
r && a && (this._isSubscribe = !1)
}
if (
(t.hasOwnProperty('transfer_mode') && (this._isRtmp = 'rtmp' === t.transfer_mode),
i.hasOwnProperty('is_phone_stream') && (this._isVertical = 1 === parseInt(i.is_phone_stream)),
t.hasOwnProperty('type'))
) {
var s = t.type
if (((this._isDanmaku = s.indexOf('bullet') > -1), t.hasOwnProperty('share_type')))
s.indexOf('share') > -1 && 'ad' === t.share_type && (this._isShareAd = !0)
;(this._isPanorama = s.indexOf('panorama') > -1),
(this._isFee = s.indexOf('fee') > -1),
(this._isChannelVip = s.indexOf('channel_vip') > -1)
}
}),
t
)
})()
e.default = s
},
function (t, e, i) {
e.__esModule = !0
var r = i(0),
a = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(1))
var s = (function () {
function t(e) {
for (var i in ((function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
r.DefaultTrialData))
(this['_' + i] = r.DefaultTrialData[i]), a.default.defineGetter(this, i)
e && this._resetTrialData(e)
}
return (
(t.prototype._resetTrialData = function (t) {
var e = 0
switch (
(t.hasOwnProperty('type') && (this._type = t.type),
t.hasOwnProperty('note') && (this._note = t.note),
this._type)
) {
case 'episodes':
case 'cannot':
e = 0
break
case 'time':
case 'subscribe':
case 'h5':
case 'zhuanti':
t.hasOwnProperty('time') && (e = t.time)
break
default:
e = 0
}
this._time = e
}),
t
)
})()
e.default = s
},
function (t, e, i) {
e.__esModule = !0
var r = (function () {
function t(t, e) {
for (var i = 0; i < e.length; i++) {
var r = e[i]
;(r.enumerable = r.enumerable || !1),
(r.configurable = !0),
'value' in r && (r.writable = !0),
Object.defineProperty(t, r.key, r)
}
}
return function (e, i, r) {
return i && t(e.prototype, i), r && t(e, r), e
}
})(),
a = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(17))
var s = {
'270p': ['3gphd'],
'320p': ['mp4sd', 'flvhd'],
'480p': ['mp4hd'],
'720p': ['mp4hd2v2', 'mp4hd2'],
'1080p': ['mp4hd3v2', 'mp4hd3'],
},
n = { '270p': '省流', '320p': '标清', '480p': '高清', '720p': '超清' },
o = (function () {
function t(e, i) {
;(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
(this._streamsData = new Map()),
(this._languageData = []),
i && i.audiolang && (this._languageData = i.audiolang),
e && this._resetStreamData(e)
}
return (
(t.prototype.getMediaStreamData = function () {
var t = this,
e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'mp4',
i = []
return (
this._streamsData.forEach(function (r, a) {
var s = t.getQualityList(a, e)
if (s.length > 0) {
var n = {}
;(n.id = a), (n.name = t.getLangCodeToCN(a)), (n.qualityList = s), i.push(n)
}
}),
i
)
}),
(t.prototype.getQualityList = function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 'mp4',
i = []
if (this._streamsData.has(t)) {
var r = this._streamsData.get(t)
if ('mp4' !== e) {
for (var a in n)
if (r.has(a)) {
var o = this.getStreamByQuality(t, a)
i.push(o)
}
} else
for (var l in n)
if (r.has(l)) {
var u = this.getStreamByQuality(t, l),
h = s[l].indexOf(u.streamType)
0 === h && i.push(u)
}
}
return i
}),
(t.prototype.buildStreamData = function (t, e) {
var i = {}
return (
(i.id = t),
(i.name = n[t]),
(i.width = e.width),
(i.height = e.height),
(i.duration = e.videoMilliSeconds / 1e3),
(i.segs = e.segs),
(i.streamURL = e.streamURL),
(i.hasLogo = e.hasLogo),
(i.streamType = e.stream_type),
i
)
}),
(t.prototype._resetStreamData = function (t) {
var e = 0,
i = 0,
r = 0,
s = void 0,
n = [],
o = void 0,
l = '',
u = ''
for (e = 0; e < t.length; e++) (o = (s = t[e]).audio_lang), -1 === n.indexOf(o) && n.push(o)
for (e = 0; e < n.length; e++) {
var h = new Map()
for (i = 0; i < t.length; i++) {
var c = new Map()
if (((l = (s = t[i]).audio_lang), (o = n[e]) === l && ((u = s.stream_type), s.segs))) {
var p = [],
d = 0,
f = 0,
y = 0,
_ = !0,
m = this.getIdByStreamType(u)
if ('0' !== m) {
for (
h.has(m) && (c = h.get(m)),
c.has(u) &&
((p = c.get(u).segs),
(d = c.get(u).size),
(f = c.get(u).milliseconds_audio),
(y = c.get(u).milliseconds_video)),
s.size && (d += s.size),
s.milliseconds_audio && (f += s.milliseconds_audio),
s.milliseconds_video && (y += s.milliseconds_video),
s.logo && 'none' === s.logo && (_ = !1),
s.stream_ext && 'none' === s.stream_ext.hls_logo && (_ = !1),
r = p.length;
r < s.segs.length;
r++
) {
var v = s.segs[r]
if (!v) break
var g = new a.default(r, v)
g.src && p.push(g)
}
s.m3u8_url && (s.streamURL = s.m3u8_url.replace('http://', 'https://')),
(s.segs = p),
(s.size = d),
(s.audioMilliSeconds = f),
(s.videoMilliSeconds = y),
(s.hasLogo = _),
c.set(u, s),
h.set(m, c)
}
}
}
this._streamsData.set(n[e], h)
}
}),
(t.prototype.getIdByStreamType = function (t) {
var e = void 0
for (e in s) {
if (-1 !== s[e].indexOf(t)) return e
}
return '0'
}),
(t.prototype.getLangCodeToCN = function (t) {
for (var e = t, i = 0; i < this._languageData.length; i++)
this._languageData[i].langcode === t && (e = this._languageData[i].lang)
return e
}),
(t.prototype.getStreamByQuality = function (t, e) {
if (this._streamsData.has(t)) {
var i = this._streamsData.get(t)
if (i.has(e))
for (var r = i.get(e), a = 0; a < s[e].length; a++)
if (r.has(s[e][a])) {
var n = r.get(s[e][a])
return this.buildStreamData(e, n)
}
}
return {}
}),
r(t, [
{
key: 'streamData',
get: function () {
return this._streamsData
},
},
]),
t
)
})()
e.default = o
},
function (t, e, i) {
e.__esModule = !0
var r = i(0),
a = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(1))
var s = (function () {
function t(e, i) {
for (var s in ((function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
r.DefaultSegmentData))
(this['_' + s] = r.DefaultSegmentData[s]), a.default.defineGetter(this, s)
;(this._index = e), i && this._resetSegmentData(i)
}
return (
(t.prototype._resetSegmentData = function (t) {
if (
(t.hasOwnProperty('size') && (this._size = t.size),
t.hasOwnProperty('total_milliseconds_video') &&
(this._seconds = parseInt(t.total_milliseconds_video) / 1e3),
t.hasOwnProperty('cdn_url'))
)
if (((this._src = t.cdn_url), -1 === t.cdn_url.indexOf('wxapp.cp31.ott.cibntv.net'))) {
var e = t.cdn_url.split('/')
;(e = e.splice(3, e.length - 3)), (this._src = 'https://wxapp.cp31.ott.cibntv.net/' + e.join('/'))
} else 0 === t.cdn_url.indexOf('http://') && (this._src = t.cdn_url.replace('http://', 'https://'))
t.hasOwnProperty('cdn_backup') &&
t.cdn_backup instanceof Array &&
t.cdn_backup.length > 0 &&
(this._backupURL = t.cdn_backup[0])
}),
t
)
})()
e.default = s
},
function (t, e, i) {
e.__esModule = !0
var r = i(0),
a = (function (t) {
return t && t.__esModule ? t : { default: t }
})(i(1))
var s = (function () {
function t(e) {
for (var i in ((function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
r.DefaultWaterMark))
(this['_' + i] = Object.assign({}, r.DefaultWaterMark[i])), a.default.defineGetter(this, i)
e && this._resetData(e)
}
return (
(t.prototype.getLogoStyle = function (t) {
var e = ''
if (t) {
var i = t
switch (i.refCoord) {
case 0:
e = 'left:' + 2 * i.posX + 'rpx;top:' + 2 * i.posY + 'rpx;'
break
case 1:
e = 'right:' + 2 * i.posX + 'rpx;top:' + 2 * i.posY + 'rpx;'
break
case 2:
e = 'right:' + 2 * i.posX + 'rpx;bottom:' + 2 * i.posY + 'rpx;'
break
case 3:
e = 'left:' + 2 * i.posX + 'rpx;bottom:' + 2 * i.posY + 'rpx;'
}
0 === i.width && (i.width = 50),
(e += 'position:absolute;width:' + 2 * i.width + 'rpx;height:auto;opacity:' + i.alpha + ';')
}
return e
}),
(t.prototype._resetData = function (t) {
for (var e = 0, i = t.length; e < i; e++) {
var r = parseInt(t[e].type),
a = t[e].displayMode,
s = t[e].displayDTOS[0]
for (var n in s) t[e][n] = s[n]
if (
(delete t[e].displayDTOS,
(1 === r || 0 === r || 4 === r || 5 === r || 6 === r || 7 === r) &&
(1 === a ? (this._logo.fullscreen = t[e]) : (0 !== a && 3 !== a) || (this._logo.normal = t[e]),
this._logo.normal && this._logo.normal.rsUrl))
) {
var o = this._logo.normal.rsUrl,
l = this.getLogoStyle(this._logo.normal),
u = this._logo.normal.rsUrl,
h = this.getLogoStyle(this._logo.normal)
this._logo.fullscreen &&
this._logo.fullscreen.rsUrl &&
((u = this._logo.fullscreen.rsUrl), (h = this.getLogoStyle(this._logo.fullscreen))),
(this._logo.logo = o),
(this._logo.logoStyle = l),
(this._logo.fullLogo = u),
(this._logo.fullLogoStyle = h)
}
3 === r &&
(1 === a
? (this._license.fullscreen = t[e])
: (0 !== a && 3 !== a) || (this._license.normal = t[e])),
2 === r &&
(1 === a
? (this._register.fullscreen = t[e])
: (0 !== a && 3 !== a) || (this._register.normal = t[e]))
}
}),
t
)
})()
e.default = s
},
function (t, e, i) {
e.__esModule = !0
var r = (function () {
function t() {
;(function (t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function')
})(this, t),
(this.historyList = []),
(this.recodeVideoTime = 0)
}
return (
(t.prototype.reset = function () {
;(this.historyList = []), (this.recodeVideoTime = 0)
}),
(t.prototype.setHistoryList = function () {
s().setStorage({ key: 'youku-historyList', data: this.historyList })
}),
(t.prototype.getHistoryList = function () {
;(this.historyList = []),
s().getStorageSync('youku-historyList') &&
(this.historyList = s().getStorageSync('youku-historyList'))
}),
(t.prototype.addHistory = function (t) {
;(this.historyList && Array.isArray(this.historyList)) || (this.historyList = []),
this.historyList.length > 49 && this.historyList.pop()
var e = {}
;(e.duration = t.videoData.duration),
(e.id = t.videoData.encodeId),
(e.idNum = t.videoData.id),
(e.title = t.videoData.title),
(e.thumbnail = t.videoData.coverURL),
(e.timestamp = new Date().getTime()),
(e.currentTime = 0),
(e.playProcess = 0),
this.historyList.splice(0, 0, e),
this.setHistoryList()
}),
(t.prototype.getCurrectVideo = function (t) {
for (var e = null, i = 0; i < this.historyList.length; i++)
if (this.historyList[i].idNum === t) {
;((e = this.historyList.splice(i, 1)[0]).timestamp = new Date().getTime()),
this.historyList.splice(0, 0, e),
this.setHistoryList()
break
}
return e
}),
(t.prototype.updataRecodeTime = function (t, e) {
if (t && e && (t - this.recodeVideoTime > 5 || t < this.recodeVideoTime)) {
this.recodeVideoTime = Number(t).toFixed(2)
for (var i = 0; i < this.historyList.length; i++)
if (this.historyList[i].idNum === e) {
var r = this.historyList.splice(i, 1)[0]
r.currentTime = this.recodeVideoTime
var a = (r.currentTime / r.duration) * 100
a > 100 && (a = 100),
(r.playProcess = parseInt(a)),
(r.timestamp = new Date().getTime()),
this.historyList.splice(0, 0, r),
this.setHistoryList()
}
}
}),
t
)
})()
e.default = r
},
])
},
},
function (t) {
t.O(0, [6907, 8096], function () {
return (e = 3609), t((t.s = e))
var e
}),
t.O()
},
])