Skip to content

Commit da66630

Browse files
committed
Initial project commit
1 parent 402da3d commit da66630

21 files changed

+8882
-0
lines changed

VideoOS-lua-app/Lua/main.lua

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

VideoOS-lua-app/Lua/os_config.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
object = {}
2+
function object:new(o)
3+
o = o or {}
4+
setmetatable(o, self)
5+
self.__index = self
6+
return o
7+
end
8+
function getScale()
9+
local screenW, screenH = System.screenSize()
10+
return math.min(screenW, screenH) / 375
11+
end
12+
is_iPhoneX = false
13+
if System.ios() then
14+
NativeScanner = NativeScanner()
15+
if Native.iPhoneX then
16+
is_iPhoneX = Native:iPhoneX()
17+
end
18+
end
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--数据统计
2+
cat_type_preshow = 10
3+
cat_type_show = 12
4+
cat_type_click_link = 47
5+
cat_type_dg_show = 34
6+
cat_type_click = 9
7+
cat_type_close = 20
8+
9+
--广告事件类型
10+
eventTypeShow = 2
11+
eventTypeClick = 3
12+
eventTypeClose = 4
13+
eventTypeBack = 5
14+
15+
--平台处理类型
16+
actionTypeNone = 0
17+
actionTypeOpenUrl = 1
18+
actionTypePauseVideo = 2
19+
actionTypePlayVideo = 3
20+
actionTypeGetItem = 4
21+
22+
--视频类型
23+
osTypeDefault = 0
24+
osTypeVideoOS = 1
25+
osTypeLiveOS = 2
26+
27+
--页面层次
28+
osHotspotViewPriority = 1
29+
osInfoViewPriority = 2

VideoOS-lua-app/Lua/os_string.lua

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require "os_config"
2+
--字符串集合--
3+
-- OS_HTTP_HOST = "http://videopublicapi.videojj.com/videoos-api/"
4+
OS_HTTP_HOST = Native:videoOShost()
5+
-- OS_HTTP_HOST = "http://dev-videopublicapi.videojj.com/videoos-api/"
6+
7+
OS_HTTP_GET_CONFIG = OS_HTTP_HOST .. "/api/config"
8+
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/queryLaunchInfo"
9+
OS_HTTP_GET_RESOURCE_LIST = OS_HTTP_HOST .. "/api/preloadLaunchInfo"
10+
OS_HTTP_GET_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileQuery"
11+
OS_HTTP_POST_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileModify"
12+
OS_HTTP_GET_COMMON_QUERY = OS_HTTP_HOST .. "/api/commonQuery"
13+
OS_HTTP_GET_SIMULATION_TAG = OS_HTTP_HOST .. "/simulation/queryInfo"
14+
15+
--数据统计网络相关
16+
OS_HTTP_GET_STARTS = OS_HTTP_HOST .. "/statistic"
17+
18+
--网络请求RSA Public Key
19+
OS_HTTP_PUBLIC_KEY = "inekcndsaqwertyi" --"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCBlxdQe+B3bCL3+km31ABB23sXUB0A3owEBodWlPeikgfEw/JfbZXuiKFoIqAbjmzpDvAE4PYAU4wBjE01wRNLg4KLJyorGLkx6I6gHE67mZqLryepxZdwd8MwzQCsoN3+PAQYUJz54Flc6e14l/LVDyggw/HN/OD9iXC027IVDQIDAQAB"
20+
--icon url
21+
local OS_ICON_HEAD = "http://videojj-mobile.oss-cn-beijing.aliyuncs.com/resource/os/"
22+
if Native:isDebug() == false then
23+
OS_ICON_HEAD = "http://videojj-mobile.oss-cn-beijing.aliyuncs.com/resource/os/" --todo 修改为正式地址
24+
end
25+
26+
OS_ICON_CLOSE = OS_ICON_HEAD .. "[email protected]"
27+
OS_ICON_BUBBLE_PROMPT_LEFT = OS_ICON_HEAD .. "[email protected]"
28+
OS_ICON_BUBBLE_PROMPT_RIGHT = OS_ICON_HEAD .. "[email protected]"
29+
OS_ICON_WEDGE_BACK = OS_ICON_HEAD .. "[email protected]"
30+
OS_ICON_WEDGE_CLOSE = OS_ICON_HEAD .. "[email protected]"
31+
OS_ICON_WIN_LINK_BACK = OS_ICON_HEAD .. "[email protected]"

VideoOS-lua-app/Lua/os_track.lua

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
require "os_config"
2+
require "os_string"
3+
--数据统计--
4+
--local OS_TRICK_SSID = "ssid=" --ssid为""写死
5+
--local OS_TRICK_PROJ = "proj=" .. Native:platformID() --playfromId
6+
--local OS_TRICK_CH = "ch=" --栏目ID为""写死
7+
--local OS_TRICK_VID = "vid=" .. Native:nativeVideoID() --房间号
8+
--local OS_TRICK_CAT = "cat=" --事件类型 1曝光 9点击
9+
--local OS_TRICK_TID = "tid=" --子组件的id可为空写死
10+
--local OS_TRICK_CID = "cid=" --资源的ID
11+
--local OS_TRICK_PTID = "ptid=" --跳转前的tid(tagId(infoid))资源的ID
12+
--local OS_TRICK_PCID = "pcid=" --跳转前的cid(contanierId(viewid))""写死
13+
--local OS_TRICK_TS = "ts=0" --时间跨度
14+
--统计方法调用--
15+
function osTrack(launchPlanId, eventType, type)
16+
local vid = Native:nativeVideoID()
17+
if (vid == nil) then
18+
return
19+
end
20+
if (launchPlanId == nil) then
21+
return
22+
end
23+
if (eventType == nil) then
24+
return
25+
end
26+
if (type == nil) then
27+
return
28+
end
29+
Native:post(OS_HTTP_GET_STARTS, {
30+
videoId = vid,
31+
type = tostring(type),
32+
eventType = tostring(eventType),
33+
launchPlanId = tostring(launchPlanId)
34+
})
35+
end
36+
37+
function osThirdPartyTrack(url)
38+
if (url ~= nil and string.match(tostring(url), "http") == "http") then
39+
Native:get(url, nil, nil, false)
40+
end
41+
end

VideoOS-lua-app/Lua/os_util.lua

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--获取tabke长度--
2+
function table_leng(t)
3+
if (t == nil) then
4+
return 0
5+
end
6+
local leng = 0
7+
for k, v in pairs(t) do
8+
leng = leng + 1
9+
end
10+
return leng;
11+
end
12+
function toTable(data) --string json 转table
13+
local dataTable
14+
if (type(data) == 'string') then
15+
if (System.android()) then
16+
dataTable = Json:toTable(data)
17+
else
18+
dataTable = Native:jsonToTable(data)
19+
end
20+
else
21+
dataTable = data
22+
end
23+
return dataTable
24+
end
25+
--四舍五入--
26+
function rounded(decimal)
27+
decimal = math.floor(decimal)
28+
if (tostring(decimal) == "nan") then
29+
return 0
30+
else
31+
return decimal
32+
end
33+
end
34+
35+
--延时执行
36+
function performWithDelay(callback, delay)
37+
if callback ~= nil and delay ~= nil then
38+
local timer = Timer()
39+
timer:interval(delay)
40+
timer:repeatCount(false)
41+
timer:delay(delay / 1000)
42+
timer:callback(callback)
43+
timer:start()
44+
return timer
45+
end
46+
end
47+
48+
--MQTT消息热点关闭方法
49+
function checkMqttHotspotToSetClose(data, callback)
50+
if data ~= nil and data.from ~= nil and data.from == "mqtt" then
51+
performWithDelay(callback, data.duration)
52+
end
53+
end

0 commit comments

Comments
 (0)