用户工具

站点工具


app:open:player:voice

保活服务

广播由服务接收,发送广播前务必保证接受广播的服务存活

      Intent serviceIntent = new Intent();
      serviceIntent.setComponent(new ComponentName("com.morequick.player", "com.morequick.player.ui.service.OtherVoiceService"));
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
           startForegroundService(serviceIntent);
      } else {
           startService(serviceIntent);
      }
      

切换指定频道广播

chanael_id参考附录,优先匹配chanael_id,否则匹配channel_name,channel_name为频道列表里的名称

例如:打开中央一台,央视一套,CCTV1,cctv1的channel_id统一为cctv1,channel_name为自己(中央一台,央视一套,CCTV1,cctv1),来保证多种说法匹配正确

打开cctv1

      Intent broadCastIntent = new Intent();
      broadCastIntent.setAction("hotel.intent.action.TV");
      broadCastIntent.putExtra("command", "live");
      broadCastIntent.putExtra("channel_id", "cctv1"); // 参考附录
      broadCastIntent.putExtra("channel_name", "cctv1");
      sendBroadcast(broadCastIntent);
      

打开中央一台

        Intent broadCastIntent = new Intent();
        broadCastIntent.setAction("hotel.intent.action.TV");
        broadCastIntent.putExtra("command", "live");
        broadCastIntent.putExtra("channel_id", "cctv1"); // 参考附录
        broadCastIntent.putExtra("channel_name", "中央一台");
        sendBroadcast(broadCastIntent);
        

打开第五个频道

        Intent broadCastIntent = new Intent();
        broadCastIntent.setAction("hotel.intent.action.TV");
        broadCastIntent.putExtra("command", "live");
        broadCastIntent.putExtra("channel_id", "5"); // 频道id位数字
        broadCastIntent.putExtra("channel_name", "");
        sendBroadcast(broadCastIntent);

切换上下频道广播

上一个台

        Intent broadCastIntent = new Intent();
        broadCastIntent.setAction("hotel.intent.action.TV");
        broadCastIntent.putExtra("command", "prev");
        sendBroadcast(broadCastIntent);
        

下一个台

        Intent broadCastIntent = new Intent();
        broadCastIntent.setAction("hotel.intent.action.TV");
        broadCastIntent.putExtra("command", "next");
        sendBroadcast(broadCastIntent);
        

附录

"cctv1":     CCTV1
"cctv2":     CCTV2
"cctv3":     CCTV3
"cctv4":     CCTV4
"cctv5":     CCTV5
"cctv5p":    CCTV5+
"cctv6":     CCTV6
"cctv7":     CCTV7
"cctv8":     CCTV8
"cctv9":     CCTV9
"cctv10":    CCTV10
"cctv11":    CCTV11
"cctv12":    CCTV12
"cctv13":    CCTV13
"cctv14":    CCTV14
"cctv15":    CCTV15
"hunanws":   湖南卫视
"bjws":      北京卫视
"jsws":      江苏卫视
"sdws":      山东卫视
"zjws":      浙江卫视
"dfws":      东方卫视
"ahws":      安徽卫视
"tjws":      天津卫视
"sxws":      山西卫视
"gsws":      甘肃卫视
"dnws":      东南卫视
"hbws":      湖北卫视
"ynws":      云南卫视
"hljws":     黑龙江卫视
"gzws":      贵州卫视
"gxws":      广西卫视
"hnws":      河南卫视
"lyws":      旅游卫视
"szws":      深圳卫视
"neimenggu": 内蒙古卫视
"gdws":      广东卫视
"xjws":      新疆卫视
"linxws":    宁夏卫视
"xzws":      西藏卫视
"xmws":      厦门卫视
"nanfangws": 广东南方卫视
"scws":      四川卫视
"hebei":     河北卫视
"qhws":      青海卫视
"jxws":      江西卫视
"lnws":      辽宁卫视
"jlws":      吉林卫视
"chongqing": 重庆卫视
"shxws":     陕西卫视
app/open/player/voice.txt · 最后更改: 2023/10/24 15:32 由 zhangjian