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 @@
.video-land-page-content
.app-button
{
width
:
44.2vw
;
height
:
9.8vw
;
margin-top
:
9.8
vw
;
margin-top
:
4.2
vw
;
background
:
rgba
(
110
,
166
,
232
,
1
);
border-radius
:
4px
;
font-size
:
17px
;
...
...
egret/src/adVideo/adVideo.ts
View file @
31cb528f
...
...
@@ -11,12 +11,17 @@ AdVideo.install(videoControlPlugin);
AdVideo
.
install
(
footerPagePlugin
);
AdVideo
.
install
(
landPagePlugin
);
interface
appContent
{
name
:
string
,
slogen
:
string
,
type
:
number
,
appIcon
:
string
}
class
MyAdvideo
{
el
:
any
;
player
:
AdVideo
;
_times
:
any
;
appContent
:
{};
url
:
string
;
isVideoIng
:
boolean
;
process25
:
boolean
;
...
...
@@ -27,6 +32,7 @@ class MyAdvideo {
playPromise
:
Promise
<
{}
>
;
strategy
:
any
;
stragegyFn
:
any
;
appContent
:
appContent
;
constructor
(
config
)
{
this
.
el
=
config
.
el
;
this
.
_times
=
{
...
...
@@ -117,19 +123,20 @@ class MyAdvideo {
}
this
.
isVideoIng
=
true
;
this
.
strategy
=
'dianxing'
;
const
res
=
await
this
.
stragegyFn
[
this
.
strategy
].
getVideo
(
'ceshi'
);
const
res
=
await
this
.
stragegyFn
[
this
.
strategy
].
getVideo
();
console
.
log
(
res
);
if
(
res
)
{
// 上报app?
if
(
window
[
"helpbridge"
]
&&
window
[
"helpbridge"
].
adShowing
)
window
[
"helpbridge"
].
adShowing
();
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
);
this
.
url
=
url
;
this
.
appContent
=
{
appIcon
,
name
,
slogen
,
type
}
return
true
;
}
else
{
...
...
@@ -153,11 +160,12 @@ class MyAdvideo {
if
(
this
.
appContent
)
{
const
starNum
=
[
4
,
4.5
,
5
][
Math
.
floor
(
Math
.
random
()
*
3
)];
const
commentNum
=
Math
.
floor
(
Math
.
random
()
*
5000
+
5000
);
const
buttonText
=
this
.
appContent
.
type
===
1
?
'立即查看'
:
'立即下载'
;
this
.
player
.
emit
(
'$landPageChangeApp'
,
Object
[
"assign"
]({
starNum
,
buttonText
:
'立即下载'
,
commentNum
},
Object
[
"assign"
]({
starNum
,
buttonText
,
commentNum
},
this
.
appContent
),
true
);
this
.
player
.
emit
(
'$footerPageChangeApp'
,
Object
[
"assign"
]({
starNum
,
buttonText
:
'立即下载'
,
commentNum
},
Object
[
"assign"
]({
starNum
,
buttonText
,
commentNum
},
this
.
appContent
),
true
);
}
else
{
this
.
player
.
emit
(
'$landPageChangeApp'
,
{},
null
);
...
...
egret/src/adVideo/dianxiangVideo.ts
View file @
31cb528f
import
{
getAppInfo
,
getDefaultConfig
,
createUnique
,
reportGet
,
replaceUrl
}
from
'./utils'
;
import
videoControl
from
'./video-core/videoPlugin/videoControl/index'
;
const
reflectConfig
=
{
ost
:
'osType'
,
...
...
@@ -9,6 +8,8 @@ const reflectConfig = {
connt
:
'connectionType'
,
androidId
:
'androidId'
,
}
const
defautToNew
=
(
raw
,
reflect
)
=>
{
const
newObj
=
{};
for
(
let
i
in
raw
)
{
...
...
@@ -142,6 +143,8 @@ function dianxingReplace(raw, url, times, event) {
}
const
report
=
{
isChanged
:
false
,
isReportDownload
:
false
,
isReportClick
:
false
,
// 加载完成
videoLoad
(
raw
,
times
)
{
const
winLoadUrls
=
raw
.
metaGroup
[
0
].
winLoadUrls
;
...
...
@@ -151,8 +154,15 @@ const report = {
})
}
},
reset
()
{
this
.
isChanged
=
false
;
this
.
isReportDownload
=
false
;
this
.
isReportClick
=
false
;
},
// 开始播放(曝光), 0进度
videoPlayStart
(
raw
,
times
)
{
// 重置内部状态
this
.
reset
();
// 曝光
const
winNoticeUrls
=
raw
.
metaGroup
[
0
].
winNoticeUrls
;
if
(
winNoticeUrls
)
{
...
...
@@ -208,9 +218,9 @@ const report = {
},
// 广告点击
async
videoClick
(
raw
,
times
,
event
)
{
const
winCNoticeUrls
=
raw
.
metaGroup
[
0
].
winCNoticeUrls
;
if
(
winCNoticeUrls
)
{
if
(
winCNoticeUrls
&&
!
this
.
isReportClick
)
{
this
.
isReportClick
=
true
;
winCNoticeUrls
.
forEach
(
e
=>
{
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
})
...
...
@@ -227,22 +237,24 @@ const report = {
const
res
=
await
window
.
fetch
(
dianxingReplace
(
raw
,
clickUrl
,
times
,
event
));
let
resJson
:
any
=
res
.
json
();
if
(
resJson
.
data
.
dstlink
)
{
window
.
location
.
href
=
clickUrl
;
return
resJson
.
data
.
dstlink
;
}
this
.
isChanged
=
false
;
}
catch
(
err
)
{
this
.
isChanged
=
false
;
console
.
log
(
'替换地址请求出错'
);
return
null
;
}
}
else
{
this
.
isChanged
=
false
;
window
.
location
.
href
=
clickUrl
;
return
clickUrl
}
},
// 广告关闭
videoClose
(
raw
,
times
,
event
)
{
const
winCloseUrls
=
raw
.
metaGroup
[
0
].
winCloseUrls
;
if
(
winCloseUrls
)
{
if
(
winCloseUrls
&&
!
this
.
isReportClick
)
{
this
.
isReportClick
=
true
;
winCloseUrls
.
forEach
(
e
=>
{
reportGet
(
dianxingReplace
(
raw
,
e
,
times
,
event
));
})
...
...
@@ -250,13 +262,26 @@ const report = {
},
// 开始下载
async
appDownload
(
raw
,
times
,
event
)
{
const
winCloseUrls
=
raw
.
metaGroup
[
0
].
winCloseUrls
;
if
(
winCloseUrls
)
{
winCloseUrls
.
forEach
(
e
=>
{
const
winDownloadUrls
=
raw
.
metaGroup
[
0
].
winDownloadUrls
;
if
(
winDownloadUrls
&&
!
this
.
isReportDownload
)
{
this
.
isReportDownload
=
true
;
winDownloadUrls
.
forEach
(
e
=>
{
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.
videoPlayEnd
(
raw
,
times
)
{
...
...
@@ -286,6 +311,8 @@ export function resolveParams(raw) {
name
:
''
,
appIcon
:
''
,
slogen
:
''
,
// 类型1.下载 2.查看
type
:
2
};
const
metaGroup
=
raw
.
metaGroup
if
(
metaGroup
&&
metaGroup
.
length
>
0
)
{
...
...
@@ -294,6 +321,11 @@ export function resolveParams(raw) {
videoRaw
.
adTitle
&&
(
ads
.
name
=
videoRaw
.
adTitle
);
videoRaw
.
iconUrls
&&
videoRaw
.
iconUrls
.
length
>
0
&&
(
ads
.
appIcon
=
videoRaw
.
iconUrls
[
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
);
return
ads
;
...
...
egret/src/adVideo/utils.ts
View file @
31cb528f
...
...
@@ -65,7 +65,7 @@ interface appInfo {
}
// 获取平台信息, app相关的,slotId , ip。
export
function
getAppInfo
():
Promise
<
appInfo
>
{
const
tVideoSlotId
=
getUrl
(
'tVideoSlotId'
);
//
const tVideoSlotId = getUrl('tVideoSlotId');
return
new
Promise
((
resolve
)
=>
{
// window.fetch(`https://activity.tuiatest.cn/commercialloanv/common/config/video/get?slotId=${tVideoSlotId}`).then(res => {
// return res.json();
...
...
egret/src/adVideo/video-core/defaultVideoConfig.ts
View file @
31cb528f
...
...
@@ -7,6 +7,6 @@ export default {
'x5-video-orientation'
:
'landscape|portrait'
,
'x5-video-player-type'
:
'h5'
,
'x-webkit-airplay'
:
'allow'
,
muted
:
tru
e
,
muted
:
fals
e
,
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