yihong0618 / MiService

XiaoMi Cloud Service for mi.com
MIT License
351 stars 90 forks source link

关于minaservice.py中的play_by_music_url的疑问 #39

Closed grayana closed 1 month ago

grayana commented 1 month ago

https://github.com/yihong0618/MiService/blob/57fdc6f18d214c3a6e09b684b80a81f00066ebf6/miservice/minaservice.py#L145

此处的type为什么设置为隐藏参数呢

    async def play_by_music_url(
        self, deviceId, url, _type=2, audio_id="1582971365183456177", id="355454500"
    ):
        _LOGGER.debug("play_by_music_url url:%s, type:%d", url, _type)
        audio_type = ""
        if _type == 1:
            # If set to MUSIC, the light will be on
            audio_type = "MUSIC"
        music = {
            "payload": {
                "audio_type": audio_type,
                "audio_items": [

按照默认情况,payload中的 audio_type会为空。 实际测试中L06A音箱在audio_type设置为"MUSIC"时可以在小爱音箱app中显示播放控件,为空时不显示。

yihong0618 commented 1 month ago

@hanxi

hanxi commented 1 month ago

设为2可以做到后台播放的效果,在L07A上的表现就是音箱不亮灯,其实都是尝试出来的,每个设备不一样的话不一定准确。其他效果就没测试了。关联问题 https://github.com/yihong0618/MiService/issues/30

grayana commented 1 month ago

设为2可以做到后台播放的效果,在L07A上的表现就是音箱不亮灯,其实都是尝试出来的,每个设备不一样的话不一定准确。其他效果就没测试了。关联问题 #30

了解了