Skip to content

Commit 222859d

Browse files
committed
Merge branch 'dev_2.0.3'
# Conflicts: # VideoOS/VenvyLibrary/src/main/assets/lua/main.lua
2 parents 9248398 + c0021a9 commit 222859d

28 files changed

+1203
-629
lines changed

VideoOS/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
/.gradle/
3+
/.idea/
4+
/build
5+
/local.properties
6+
.DS_Store
7+
/captures
8+
.externalNativeBuild
9+
/vidoeos_demo/
10+
/venvy_glide_v4/

VideoOS/LuaViewSDK/src/cn/com/venvy/lua/plugin/LVPreLoadPlugin.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import com.taobao.luaview.util.LuaUtil;
44

5+
import org.json.JSONArray;
6+
import org.json.JSONObject;
57
import org.luaj.vm2.LuaTable;
68
import org.luaj.vm2.LuaValue;
79
import org.luaj.vm2.Varargs;
810
import org.luaj.vm2.lib.VarArgFunction;
911

12+
import java.util.HashMap;
1013
import java.util.Map;
1114

1215
import cn.com.venvy.Platform;
@@ -25,6 +28,7 @@ public class LVPreLoadPlugin {
2528
public static void install(VenvyLVLibBinder venvyLVLibBinder, Platform platform) {
2629
venvyLVLibBinder.set("preloadImage", new PreLoadImageData(platform));
2730
venvyLVLibBinder.set("preloadVideo", new PreLoadVideoCacheData(platform));
31+
venvyLVLibBinder.set("preloadLuaList", new PreLoadLuaCacheData(platform));
2832
venvyLVLibBinder.set("isCacheVideo", sISVideoCachedData == null ? sISVideoCachedData = new ISVideoCachedData() : sISVideoCachedData);
2933
}
3034

@@ -82,6 +86,37 @@ public LuaValue invoke(Varargs args) {
8286
}
8387
}
8488

89+
private static class PreLoadLuaCacheData extends VarArgFunction {
90+
private Platform mPlatform;
91+
92+
PreLoadLuaCacheData(Platform platform) {
93+
super();
94+
this.mPlatform = platform;
95+
}
96+
97+
@Override
98+
public LuaValue invoke(Varargs args) {
99+
int fixIndex = VenvyLVLibBinder.fixIndex(args);
100+
if (args.narg() > fixIndex) {
101+
LuaTable table = LuaUtil.getTable(args, fixIndex + 1);
102+
try {
103+
HashMap<String, String> paramsMap = LuaUtil.toMap(table);
104+
if (paramsMap == null || paramsMap.size() <= 0) {
105+
return LuaValue.NIL;
106+
}
107+
JSONArray proLoadArray=new JSONArray();
108+
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
109+
proLoadArray.put(new JSONObject(entry.getValue().toString()));
110+
}
111+
mPlatform.preloadLuaList(mPlatform, proLoadArray);
112+
} catch (Exception e) {
113+
e.printStackTrace();
114+
}
115+
}
116+
return LuaValue.NIL;
117+
}
118+
}
119+
85120
private static class ISVideoCachedData extends VarArgFunction {
86121
DownloadDbHelper mHelper;
87122

VideoOS/VenvyLibrary/src/main/assets/lua/main.lua

Lines changed: 76 additions & 18 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
146169

147-
if (response.status == "00") then
148-
if checkAdTable[data.id] ~= nil then
149-
checkAdTable[data.id] = true
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()

VideoOS/VenvyLibrary/src/main/assets/lua/os_string.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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"

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
public class Config {
9-
public static String SDK_VERSION = "2.0.0";
9+
public static String SDK_VERSION = "2.0.1";
1010
public static String HOST_VIDEO_OS = "https://os-saas.videojj.com/os-api-saas";
1111
public static boolean REPORT_ABLE = true;
1212
public static int DEBUG_STATUS = 0;

0 commit comments

Comments
 (0)