解说社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 281|回复: 2

[原创] 媒体控制面板,包括播放暂停上一曲下一曲快进快退音频闪避和蓝牙时读屏声音通道的切换

[复制链接]
发表于 2023-9-14 13:48:38 来自手机 | 显示全部楼层 |阅读模式
本帖最后由 hoibo 于 2023-9-14 13:52 编辑

require "import"
import "android.widget.*"
import "android.view.*"
layout=
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,


{
Button,
text="增大音量",
onClick="zdyl",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="上一曲",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="音频闪避",
onClick="ypsb",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="快退",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="播放暂停",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="快进",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="减小音量",
onClick="jxyl",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
{Button,
text="下一曲",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
{Button,
text="链接蓝牙读屏是否留在手机",
onClick="qhly",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
}

dlg=LuaDialog()
.setView(loadlayout(layout))
.show()
function mtgn(v)
service.execute(v.getText(),node)
end
function ypsb()
if ypkg
service.setAudioFocus(true)
service.asyncSpeak("打开音频闪避")
ypkg=nil
else
service.setAudioFocus(false)
service.asyncSpeak("关闭音频闪避")
ypkg=true
end
end
function qhly()
if qhtd
service.setUseNoBluetooth(false)
service.asyncSpeak("跟随蓝牙")
qhtd=nil
else
service.setUseNoBluetooth(true)
service.asyncSpeak("留在手机")
qhtd=true
end
end
function zdyl()
task(100,function()
service.raiseVolume()
end)
end
function jxyl()
task(100,function()
service.lowerVolume()
end)
end
回复

使用道具 举报

发表于 2023-9-14 22:40:37 来自手机 | 显示全部楼层
快退和快进的秒数能自定义吗?



  来自解说社区客户端
回复

使用道具 举报

 楼主| 发表于 2023-9-18 23:34:00 来自手机 | 显示全部楼层
回复 沙发talkback

秒数这个自定义不了啊。这个是调用读屏的功能。



  来自解说社区客户端
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|解说社区

GMT+8, 2024-5-3 04:36 , Processed in 0.040148 second(s), 13 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表