解决秋果数字空间推送播放音乐问题

This commit is contained in:
wulin 2023-10-28 21:09:08 +08:00
parent 6b72bdf921
commit 1c7a8905c1
3 changed files with 26 additions and 1 deletions

View File

@ -76,7 +76,7 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
log.info("推送Box播放音乐");
BoxSession boxSession = baseWebSocketService.getBoxSessionWithSn(baseSession.getSn());
if(boxSession != null){
baseWebSocketService.sendMsg(baseSession, resp);
baseWebSocketService.sendMsg(boxSession, resp);
//记录音乐状态
if(resp.getMusic().getPlay().equals(PlayEnum.STOP.getCode())){
//去掉内存中音乐同步对象

View File

@ -33,6 +33,14 @@
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.belerweb/pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>
<build>

View File

@ -1,6 +1,10 @@
package com.qiuguo.iot.customer.http.api.filter;
import lombok.extern.slf4j.Slf4j;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.hswebframework.web.logger.ReactiveLogger;
import org.reactivestreams.Publisher;
import org.slf4j.MDC;
@ -114,4 +118,17 @@ public class LogWebFilter implements WebFilter {
};
}
public static void main(String[] args) throws BadHanyuPinyinOutputFormatCombination {
String chineseText = "你好,世界!";
// 将中文文本转换为拼音数组
HanyuPinyinOutputFormat hanyuPinyinOutputFormat = new HanyuPinyinOutputFormat();
hanyuPinyinOutputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
String pinyinArray = PinyinHelper.toHanYuPinyinString(chineseText, hanyuPinyinOutputFormat, null, false);
// 打印拼音结果
System.out.print(pinyinArray + " ");
}
}