-
Notifications
You must be signed in to change notification settings - Fork 760
Expand file tree
/
Copy pathNUI_AudioPlayer.lua
More file actions
65 lines (49 loc) · 1.19 KB
/
NUI_AudioPlayer.lua
File metadata and controls
65 lines (49 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- Created by LuaView.
-- Copyright (c) 2017, Alibaba Group. All rights reserved.
--
-- This source code is licensed under the MIT.
-- For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
w, h = System:screenSize();
local player1 = AudioPlayer();
button1 = Button();
button1:title("播放音效-url");
button1:callback(function()
if (player1) then
player1:play("http://dx.sc.chinaz.com/files/download/sound1/201308/3381.wav", 2);
end
end)
button2 = Button();
button2:title("播放音效-本地");
button2:xy(200, 0)
button2:callback(function()
if (player1) then
player1:play("music/test.mp3", 0);
end
end)
button1_pause = Button();
button1_pause:title("pause")
button1_pause:xy(0, 50)
button1_pause:callback(function()
if (player1) then
player1:pause();
end
end)
button1_resume = Button();
button1_resume:title("resume")
button1_resume:xy(200, 50)
button1_resume:callback(function()
if (player1) then
player1:resume();
end
end)
t = {
a = function()
print('a called', t.c)
end,
b = function()
print('b called', t.c)
end,
c = 1
}
t.a()
t.b()