欢迎光临散文网 会员登陆 & 注册

andlua第四期(调用音乐)

2023-02-12 18:06 作者:北念官  | 我要投稿

local 音频播放器=MediaPlayer()

function 播放(路径)

音频播放器.reset()

.setDataSource(路径)

.prepare()

.start()

.setOnCompletionListener({

onCompletion=function()

end})

end

function 暂停(路径)

音频播放器.reset()

end

-----------------------------调用音乐-------------------------------

function 歌曲1.onClick()


if 歌曲1.checked==true then

播放(activity.getLuaDir("mp3/1"))

提示("正在播放你看到的我","20sp")

end

if 歌曲1.checked==false then

暂停(activity.getLuaDir("mp3/1"))

提示("已停止")

end

end


function 歌曲2.onClick()


if 歌曲2.checked==true then

播放(activity.getLuaDir("mp3/2"))

提示("正在播放遗失的心跳")

end

if 歌曲2.checked==false then

暂停(activity.getLuaDir("mp3/2"))

提示("已停止")

end

end

andlua第四期(调用音乐)的评论 (共 条)

分享到微博请遵守国家法律