Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaoleTuia
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王剑峰
xiaoxiaoleTuia
Commits
31cb528f
Commit
31cb528f
authored
Feb 18, 2020
by
liupengfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
af52d495
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
18 deletions
+58
-18
advideo.css
egret/advideo.css
+1
-1
adVideo.ts
egret/src/adVideo/adVideo.ts
+13
-5
dianxiangVideo.ts
egret/src/adVideo/dianxiangVideo.ts
+42
-10
utils.ts
egret/src/adVideo/utils.ts
+1
-1
defaultVideoConfig.ts
egret/src/adVideo/video-core/defaultVideoConfig.ts
+1
-1
No files found.
egret/advideo.css
View file @
31cb528f
...
@@ -189,7 +189,7 @@
...
@@ -189,7 +189,7 @@
.video-land-page-content
.app-button
{
.video-land-page-content
.app-button
{
width
:
44.2vw
;
width
:
44.2vw
;
height
:
9.8vw
;
height
:
9.8vw
;
margin-top
:
9.8
vw
;
margin-top
:
4.2
vw
;
background
:
rgba
(
110
,
166
,
232
,
1
);
background
:
rgba
(
110
,
166
,
232
,
1
);
border-radius
:
4px
;
border-radius
:
4px
;
font-size
:
17px
;
font-size
:
17px
;
...
...
egret/src/adVideo/adVideo.ts
View file @
31cb528f
...
@@ -11,12 +11,17 @@ AdVideo.install(videoControlPlugin);
...
@@ -11,12 +11,17 @@ AdVideo.install(videoControlPlugin);
AdVideo
.
install
(
footerPagePlugin
);
AdVideo
.
install
(
footerPagePlugin
);
AdVideo
.
install
(
landPagePlugin
);
AdVideo
.
install
(
landPagePlugin
);
interface
appContent
{
name
:
string
,
slogen
:
string
,
type
:
number
,
appIcon
:
string
}
class
MyAdvideo
{
class
MyAdvideo
{
el
:
any
;
el
:
any
;
player
:
AdVideo
;
player
:
AdVideo
;
_times
:
any
;
_times
:
any
;
appContent
:
{};
url
:
string
;
url
:
string
;
isVideoIng
:
boolean
;
isVideoIng
:
boolean
;
process25
:
boolean
;
process25
:
boolean
;
...
@@ -27,6 +32,7 @@ class MyAdvideo {
...
@@ -27,6 +32,7 @@ class MyAdvideo {
playPromise
:
Promise
<
{}
>
;
playPromise
:
Promise
<
{}
>
;
strategy
:
any
;
strategy
:
any
;
stragegyFn
:
any
;
stragegyFn
:
any
;
appContent
:
appContent
;
constructor
(
config
)
{
constructor
(
config
)
{
this
.
el
=
config
.
el
;
this
.
el
=
config
.
el
;
this
.
_times
=
{
this
.
_times
=
{
...
@@ -117,19 +123,20 @@ class MyAdvideo {
...
@@ -117,19 +123,20 @@ class MyAdvideo {
}
}
this
.
isVideoIng
=
true
;
this
.
isVideoIng
=
true
;
this
.
strategy
=
'dianxing'
;
this
.
strategy
=
'dianxing'
;
const
res
=
await
this
.
stragegyFn
[
this
.
strategy
].
getVideo
(
'ceshi'
);
const
res
=
await
this
.
stragegyFn
[
this
.
strategy
].
getVideo
();
console
.
log
(
res
);
console
.
log
(
res
);
if
(
res
)
{
if
(
res
)
{
// 上报app?
// 上报app?
if
(
window
[
"helpbridge"
]
&&
window
[
"helpbridge"
].
adShowing
)
window
[
"helpbridge"
].
adShowing
();
if
(
window
[
"helpbridge"
]
&&
window
[
"helpbridge"
].
adShowing
)
window
[
"helpbridge"
].
adShowing
();
this
.
videoRaw
=
res
;
this
.
videoRaw
=
res
;
const
{
url
,
appIcon
,
name
,
slogen
}
=
this
.
stragegyFn
[
this
.
strategy
].
resolveParams
(
this
.
videoRaw
);
const
{
url
,
appIcon
,
name
,
slogen
,
type
}
=
this
.
stragegyFn
[
this
.
strategy
].
resolveParams
(
this
.
videoRaw
);
console
.
log
(
url
);
console
.
log
(
url
);
this
.
url
=
url
;
this
.
url
=
url
;
this
.
appContent
=
{
this
.
appContent
=
{
appIcon
,
appIcon
,
name
,
name
,
slogen
,
slogen
,
type
}
}
return
true
;
return
true
;
}
else
{
}
else
{
...
@@ -153,11 +160,12 @@ class MyAdvideo {
...
@@ -153,11 +160,12 @@ class MyAdvideo {
if
(
this
.
appContent
)
{
if
(
this
.
appContent
)
{
const
starNum
=
[
4
,
4.5
,
5
][
Math
.
floor
(
Math
.
random
()
*
3
)];
const
starNum
=
[
4
,
4.5
,
5
][
Math
.
floor
(
Math
.
random
()
*
3
)];
const
commentNum
=
Math
.
floor
(
Math
.
random
()
*
5000
+
5000
);
const
commentNum
=
Math
.
floor
(
Math
.
random
()
*
5000
+
5000
);
const
buttonText
=
this
.
appContent
.
type
===
1
?
'立即查看'
:
'立即下载'
;
this
.
player
.
emit
(
'$landPageChangeApp'
,
this
.
player
.
emit
(
'$landPageChangeApp'
,
Object
[
"assign"
]({
starNum
,
buttonText
:
'立即下载'
,
commentNum
},
Object
[
"assign"
]({
starNum
,
buttonText
,
commentNum
},
this
.
appContent
),
true
);
this
.
appContent
),
true
);
this
.
player
.
emit
(
'$footerPageChangeApp'
,
this
.
player
.
emit
(
'$footerPageChangeApp'
,
Object
[
"assign"
]({
starNum
,
buttonText
:
'立即下载'
,
commentNum
},
Object
[
"assign"
]({
starNum
,
buttonText
,
commentNum
},
this
.
appContent
),
true
);
this
.
appContent
),
true
);
}
else
{
}
else
{
this
.
player
.
emit
(
'$landPageChangeApp'
,
{},
null
);
this
.
player
.
emit
(
'$landPageChangeApp'
,
{},
null
);
...
...
egret/src/adVideo/dianxiangVideo.ts
View file @
31cb528f
import
{
getAppInfo
,
getDefaultConfig
,
createUnique
,
reportGet
,
replaceUrl
}
from
'./utils'
;
import
{
getAppInfo
,
getDefaultConfig
,
createUnique
,
reportGet
,
replaceUrl
}
from
'./utils'
;
import
videoControl
from
'./video-core/videoPlugin/videoControl/index'
;
const
reflectConfig
=
{
const
reflectConfig
=
{
ost
:
'osType'
,
ost
:
'osType'
,
...
@@ -9,6 +8,8 @@ const reflectConfig = {
...
@@ -9,6 +8,8 @@ const reflectConfig = {
connt
:
'connectionType'
,
connt
:
'connectionType'
,
androidId
:
'androidId'
,
androidId
:
'androidId'
,
}
}
const
defautToNew
=
(
raw
,
reflect
)
=>
{
const
defautToNew
=
(
raw
,
reflect
)
=>
{
const
newObj
=
{};
const
newObj
=
{};
for
(
let
i
in
raw
)
{
for
(
let
i
in
raw
)
{
...
@@ -142,6 +143,8 @@ function dianxingReplace(raw, url, times, event) {
...
@@ -142,6 +143,8 @@ function dianxingReplace(raw, url, times, event) {
}
}
const
report
=
{
const
report
=
{
isChanged
:
false
,
isChanged
:
false
,
isReportDownload
:
false
,
isReportClick
:
false
,
// 加载完成
// 加载完成
videoLoad
(
raw
,
times
)
{
videoLoad
(
raw
,
times
)
{
const
winLoadUrls
=
raw
.
metaGroup
[
0
].
winLoadUrls
;
const
winLoadUrls
=
raw
.
metaGroup
[
0
].
winLoadUrls
;
...
@@ -151,8 +154,15 @@ const report = {
...
@@ -151,8 +154,15 @@ const report = {
})
})
}
}
},
},
reset
()
{
this
.
isChanged
=
false
;
this
.
isReportDownload
=
false
;
this
.
isReportClick
=
false
;
},
// 开始播放(曝光), 0进度
// 开始播放(曝光), 0进度
videoPlayStart
(
raw
,
times
)
{
videoPlayStart
(
raw
,
times
)
{
// 重置内部状态
this
.
reset
();
// 曝光
// 曝光
const
winNoticeUrls
=
raw
.
metaGroup
[
0
].
winNoticeUrls
;
const
winNoticeUrls
=
raw
.
metaGroup
[
0
].
winNoticeUrls
;
if
(
winNoticeUrls
)
{
if
(
winNoticeUrls
)
{
...
@@ -208,9 +218,9 @@ const report = {
...
@@ -208,9 +218,9 @@ const report = {
},
},
// 广告点击
// 广告点击
async
videoClick
(
raw
,
times
,
event
)
{
async
videoClick
(
raw
,
times
,
event
)
{
const
winCNoticeUrls
=
raw
.
metaGroup
[
0
].
winCNoticeUrls
;
const
winCNoticeUrls
=
raw
.
metaGroup
[
0
].
winCNoticeUrls
;
if
(
winCNoticeUrls
)
{
if
(
winCNoticeUrls
&&
!
this
.
isReportClick
)
{
this
.
isReportClick
=
true
;
winCNoticeUrls
.
forEach
(
e
=>
{
winCNoticeUrls
.
forEach
(
e
=>
{
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
})
})
...
@@ -227,22 +237,24 @@ const report = {
...
@@ -227,22 +237,24 @@ const report = {
const
res
=
await
window
.
fetch
(
dianxingReplace
(
raw
,
clickUrl
,
times
,
event
));
const
res
=
await
window
.
fetch
(
dianxingReplace
(
raw
,
clickUrl
,
times
,
event
));
let
resJson
:
any
=
res
.
json
();
let
resJson
:
any
=
res
.
json
();
if
(
resJson
.
data
.
dstlink
)
{
if
(
resJson
.
data
.
dstlink
)
{
window
.
location
.
href
=
clickUrl
;
return
resJson
.
data
.
dstlink
;
}
}
this
.
isChanged
=
false
;
this
.
isChanged
=
false
;
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
isChanged
=
false
;
this
.
isChanged
=
false
;
console
.
log
(
'替换地址请求出错'
);
console
.
log
(
'替换地址请求出错'
);
return
null
;
}
}
}
else
{
}
else
{
this
.
isChanged
=
false
;
this
.
isChanged
=
false
;
window
.
location
.
href
=
clickUrl
;
return
clickUrl
}
}
},
},
// 广告关闭
// 广告关闭
videoClose
(
raw
,
times
,
event
)
{
videoClose
(
raw
,
times
,
event
)
{
const
winCloseUrls
=
raw
.
metaGroup
[
0
].
winCloseUrls
;
const
winCloseUrls
=
raw
.
metaGroup
[
0
].
winCloseUrls
;
if
(
winCloseUrls
)
{
if
(
winCloseUrls
&&
!
this
.
isReportClick
)
{
this
.
isReportClick
=
true
;
winCloseUrls
.
forEach
(
e
=>
{
winCloseUrls
.
forEach
(
e
=>
{
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
})
})
...
@@ -250,13 +262,26 @@ const report = {
...
@@ -250,13 +262,26 @@ const report = {
},
},
// 开始下载
// 开始下载
async
appDownload
(
raw
,
times
,
event
)
{
async
appDownload
(
raw
,
times
,
event
)
{
const
winCloseUrls
=
raw
.
metaGroup
[
0
].
winCloseUrls
;
const
winDownloadUrls
=
raw
.
metaGroup
[
0
].
winDownloadUrls
;
if
(
winCloseUrls
)
{
if
(
winDownloadUrls
&&
!
this
.
isReportDownload
)
{
winCloseUrls
.
forEach
(
e
=>
{
this
.
isReportDownload
=
true
;
winDownloadUrls
.
forEach
(
e
=>
{
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
})
})
}
}
await
this
.
changeUrl
(
raw
,
times
,
event
)
const
url
=
await
this
.
changeUrl
(
raw
,
times
,
event
)
console
.
log
(
raw
);
if
(
raw
.
metaGroup
[
0
].
interactionType
===
2
)
{
window
.
location
.
href
=
url
;
return
;
}
if
(
url
&&
window
[
'bridge'
]
&&
window
[
'bridge'
].
jumpAdUrl
)
{
window
[
'bridge'
].
jumpAdUrl
(
url
)
}
else
{
console
.
log
(
url
);
console
.
log
(
window
[
'bridge'
]);
console
.
log
(
window
[
'bridge'
].
jumpAdUrl
);
}
},
},
// 播放完毕, 进度100.
// 播放完毕, 进度100.
videoPlayEnd
(
raw
,
times
)
{
videoPlayEnd
(
raw
,
times
)
{
...
@@ -286,6 +311,8 @@ export function resolveParams(raw) {
...
@@ -286,6 +311,8 @@ export function resolveParams(raw) {
name
:
''
,
name
:
''
,
appIcon
:
''
,
appIcon
:
''
,
slogen
:
''
,
slogen
:
''
,
// 类型1.下载 2.查看
type
:
2
};
};
const
metaGroup
=
raw
.
metaGroup
const
metaGroup
=
raw
.
metaGroup
if
(
metaGroup
&&
metaGroup
.
length
>
0
)
{
if
(
metaGroup
&&
metaGroup
.
length
>
0
)
{
...
@@ -294,6 +321,11 @@ export function resolveParams(raw) {
...
@@ -294,6 +321,11 @@ export function resolveParams(raw) {
videoRaw
.
adTitle
&&
(
ads
.
name
=
videoRaw
.
adTitle
);
videoRaw
.
adTitle
&&
(
ads
.
name
=
videoRaw
.
adTitle
);
videoRaw
.
iconUrls
&&
videoRaw
.
iconUrls
.
length
>
0
&&
(
ads
.
appIcon
=
videoRaw
.
iconUrls
[
0
]);
videoRaw
.
iconUrls
&&
videoRaw
.
iconUrls
.
length
>
0
&&
(
ads
.
appIcon
=
videoRaw
.
iconUrls
[
0
]);
videoRaw
.
descs
&&
videoRaw
.
descs
.
length
>
0
&&
(
ads
.
slogen
=
videoRaw
.
descs
[
0
]);
videoRaw
.
descs
&&
videoRaw
.
descs
.
length
>
0
&&
(
ads
.
slogen
=
videoRaw
.
descs
[
0
]);
if
(
videoRaw
.
interactionType
===
2
)
{
ads
.
type
===
1
}
else
{
ads
.
type
===
2
}
}
}
console
.
log
(
ads
);
console
.
log
(
ads
);
return
ads
;
return
ads
;
...
...
egret/src/adVideo/utils.ts
View file @
31cb528f
...
@@ -65,7 +65,7 @@ interface appInfo {
...
@@ -65,7 +65,7 @@ interface appInfo {
}
}
// 获取平台信息, app相关的,slotId , ip。
// 获取平台信息, app相关的,slotId , ip。
export
function
getAppInfo
():
Promise
<
appInfo
>
{
export
function
getAppInfo
():
Promise
<
appInfo
>
{
const
tVideoSlotId
=
getUrl
(
'tVideoSlotId'
);
//
const tVideoSlotId = getUrl('tVideoSlotId');
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
// window.fetch(`https://activity.tuiatest.cn/commercialloanv/common/config/video/get?slotId=${tVideoSlotId}`).then(res => {
// window.fetch(`https://activity.tuiatest.cn/commercialloanv/common/config/video/get?slotId=${tVideoSlotId}`).then(res => {
// return res.json();
// return res.json();
...
...
egret/src/adVideo/video-core/defaultVideoConfig.ts
View file @
31cb528f
...
@@ -7,6 +7,6 @@ export default {
...
@@ -7,6 +7,6 @@ export default {
'x5-video-orientation'
:
'landscape|portrait'
,
'x5-video-orientation'
:
'landscape|portrait'
,
'x5-video-player-type'
:
'h5'
,
'x5-video-player-type'
:
'h5'
,
'x-webkit-airplay'
:
'allow'
,
'x-webkit-airplay'
:
'allow'
,
muted
:
tru
e
,
muted
:
fals
e
,
crossorigin
:
'anonymous'
crossorigin
:
'anonymous'
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment