Skip to content

Commit aae4d4d

Browse files
committed
update lua
1 parent 8745545 commit aae4d4d

File tree

3 files changed

+80
-21
lines changed

3 files changed

+80
-21
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"1.3.2"}
1+
{"version":"2.1.0"}

Resources/VideoPlsResources.bundle/lua/main.lua

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,40 @@ local function closeAdView(adId, data)
104104
end
105105
end
106106

107+
local function trackNotice(data, requestType, status, isShow)
108+
if (data == nil or requestType == nil or status == nil or isShow == nil) then
109+
return nil
110+
end
111+
112+
-- local OS_HTTP_POST_CHECK_HOTSPOT_TRACK = OS_HTTP_HOST .. "/statisticConfirmLaunch"
113+
114+
local paramData = {
115+
videoId = Native:nativeVideoID(),
116+
id = data.id,
117+
launchPlanId = data.launchPlanId,
118+
createId = data.createId,
119+
timestamp = data.videoStartTime,
120+
type = requestType,
121+
status = status,
122+
isShow = isShow,
123+
commonParam = Native:commonParam()
124+
}
125+
126+
local paramDataString = Native:tableToJson(paramData)
127+
128+
-- print("[LuaView] "..paramDataString)
129+
-- print("[LuaView] "..OS_HTTP_POST_CHECK_HOTSPOT_TRACK)
130+
131+
mainNode.request:post(OS_HTTP_POST_CHECK_HOTSPOT_TRACK, {
132+
bu_id = buId,
133+
device_type = deviceType,
134+
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
135+
}, function(response, errorInfo)
136+
-- print("luaview getVoteCountInfo")
137+
138+
end)
139+
end
140+
107141
local function checkHotspotShow(data)
108142

109143
if (data == nil) then
@@ -132,24 +166,30 @@ local function checkHotspotShow(data)
132166
data = Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
133167
}, function(response, errorInfo)
134168
-- print("luaview getVoteCountInfo")
135-
if (response == nil) then
136-
return
137-
end
138-
-- print("luaview getVoteCountInfo 11"..Native:tableToJson(response))
139-
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
140-
-- print("luaview " .. Native:tableToJson(data))
141-
-- print("luaview " .. responseData)
142-
response = toTable(responseData)
143-
if (response.resCode ~= "00") then
144-
return
145-
end
146-
147-
if (response.status == "00") then
148-
if checkAdTable[data.id] ~= nil then
149-
checkAdTable[data.id] = true
169+
170+
local requestType = 0
171+
local playStatus = 0
172+
local isShow = 0
173+
if (response ~= nil) then
174+
requestType = 1
175+
-- print("luaview getVoteCountInfo 11"..Native:tableToJson(response))
176+
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
177+
-- print("luaview " .. Native:tableToJson(data))
178+
-- print("luaview " .. responseData)
179+
response = toTable(responseData)
180+
if (response.resCode == "00") then
181+
if (response.status == "00") then
182+
playStatus = 1
183+
if checkAdTable[data.id] ~= nil then
184+
checkAdTable[data.id] = true
185+
end
186+
if data.videoStartTime + adShowInterval > lastProgress then
187+
isShow = 1
188+
end
189+
end
150190
end
151191
end
152-
192+
trackNotice(data, requestType, playStatus, isShow)
153193
end)
154194
end
155195

@@ -312,7 +352,7 @@ local function getTaglist()
312352
return
313353
end
314354
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
315-
--print("luaview "..responseData)
355+
print("luaview "..responseData)
316356

317357
response = toTable(responseData)
318358
if (response.resCode ~= "00") then
@@ -322,7 +362,19 @@ local function getTaglist()
322362
if (dataTable == nil) then
323363
return
324364
end
325-
--osTypeVideoOS = 1, osTypeLiveOS = 2, 直播开启Mqtt,点播不开启
365+
366+
--下载投放的lua文件
367+
local luaList = {}
368+
for i,v in ipairs(dataTable) do
369+
if (v.luaList ~= nil ) then
370+
for i,v in ipairs(v.luaList) do
371+
table.insert(luaList, v)
372+
end
373+
end
374+
end
375+
Native:preloadLuaList(luaList)
376+
377+
--osTypeVideoOS = 1, osTypeLiveOS = 2, 点播按时间点加载,直播直接加载
326378
if Native:osType() < osTypeLiveOS then
327379
print("osTypeVideoOS")
328380
for key, value in pairs(dataTable) do
@@ -440,7 +492,8 @@ local function getResourcelist()
440492
local videoList = {}
441493
local imageList = {}
442494
for i, v in ipairs(dataTable) do
443-
local position = string.find(v, ".mp4", 1)
495+
local lowerUrl = string.lower(v)
496+
local position = string.find(lowerUrl, ".mp4", 1)
444497
if position ~= nil and position > 0 then
445498
table.insert(videoList, v)
446499
else
@@ -498,6 +551,11 @@ function show(args)
498551
if (response.resCode ~= "00") then
499552
return
500553
end
554+
555+
if (response.confirmTime ~= nil) then
556+
adCheckInterval = response.confirmTime * 1000.0
557+
end
558+
501559
mainNode.mqtt = registerMqtt(response)
502560
getTag()
503561
getResourcelist()

Resources/VideoPlsResources.bundle/lua/os_string.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ OS_HTTP_HOST = Native:videoOShost()
55
-- OS_HTTP_HOST = "http://dev-videopublicapi.videojj.com/videoos-api/"
66

77
OS_HTTP_GET_CONFIG = OS_HTTP_HOST .. "/api/config"
8-
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/queryLaunchInfo"
8+
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/v2/queryLaunchInfo"
99
OS_HTTP_GET_RESOURCE_LIST = OS_HTTP_HOST .. "/api/preloadLaunchInfo"
1010
OS_HTTP_GET_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileQuery"
1111
OS_HTTP_POST_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileModify"
1212
OS_HTTP_GET_COMMON_QUERY = OS_HTTP_HOST .. "/api/commonQuery"
1313
OS_HTTP_GET_SIMULATION_TAG = OS_HTTP_HOST .. "/simulation/queryInfo"
1414
OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/notice"
15+
OS_HTTP_POST_CHECK_HOTSPOT_TRACK = OS_HTTP_HOST .. "/statisticConfirmLaunch"
1516

1617
--数据统计网络相关
1718
OS_HTTP_GET_STARTS = OS_HTTP_HOST .. "/statistic"

0 commit comments

Comments
 (0)