|
@@ -128,6 +128,7 @@ import {
|
|
|
} from '@kit.UIDesignKit';
|
|
} from '@kit.UIDesignKit';
|
|
|
import { GlobalAlphabetIndexerModifier } from '../Styels/GlobalStyles'
|
|
import { GlobalAlphabetIndexerModifier } from '../Styels/GlobalStyles'
|
|
|
import { getFirstLetter } from '../Constants';
|
|
import { getFirstLetter } from '../Constants';
|
|
|
|
|
+import { audio } from '@kit.AudioKit';
|
|
|
const TAG = 'LocalMusic';
|
|
const TAG = 'LocalMusic';
|
|
|
const HICAR_LOG_TAG = 'HiCarWindow';
|
|
const HICAR_LOG_TAG = 'HiCarWindow';
|
|
|
|
|
|
|
@@ -1208,7 +1209,10 @@ export struct LocalMusic {
|
|
|
console.info('onecold startPlayOrResumePlay 514')
|
|
console.info('onecold startPlayOrResumePlay 514')
|
|
|
this.startPlayOrResumePlay();
|
|
this.startPlayOrResumePlay();
|
|
|
} else if (event.hintType === InterruptHintType.INTERRUPT_HINT_STOP) {
|
|
} else if (event.hintType === InterruptHintType.INTERRUPT_HINT_STOP) {
|
|
|
- this.stop();
|
|
|
|
|
|
|
+ console.info(`onecold 与其他应用音频冲突 被截断点 INTERRUPT_HINT_STOP`)
|
|
|
|
|
+ if(!this.isSameTimePlay){
|
|
|
|
|
+ this.stop();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1415,6 +1419,29 @@ export struct LocalMusic {
|
|
|
this.fastForwardSeconds = PreferencesUtil.getStringSync('fastForwardSeconds', '10')
|
|
this.fastForwardSeconds = PreferencesUtil.getStringSync('fastForwardSeconds', '10')
|
|
|
this.isShowBackFast = PreferencesUtil.getBooleanSync('isShowBackFast', false)
|
|
this.isShowBackFast = PreferencesUtil.getBooleanSync('isShowBackFast', false)
|
|
|
this.isCopyFileToDownLoad = PreferencesUtil.getBooleanSync(SettingPage.IS_COPYFILE_TO_DOWNLOAD, false)
|
|
this.isCopyFileToDownLoad = PreferencesUtil.getBooleanSync(SettingPage.IS_COPYFILE_TO_DOWNLOAD, false)
|
|
|
|
|
+ let audioManager = audio.getAudioManager();
|
|
|
|
|
+ let audioSessionManager: audio.AudioSessionManager = audioManager.getSessionManager();
|
|
|
|
|
+ if(this.isSameTimePlay){
|
|
|
|
|
+ //与其他应用同时播放,关键代码
|
|
|
|
|
+ let strategy: audio.AudioSessionStrategy = {
|
|
|
|
|
+ concurrencyMode: audio.AudioConcurrencyMode.CONCURRENCY_MIX_WITH_OTHERS
|
|
|
|
|
+ };
|
|
|
|
|
+ audioSessionManager.activateAudioSession(strategy).then(() => {
|
|
|
|
|
+ console.info('onecold Succeeded in doing activateAudioSession.');
|
|
|
|
|
+ }).catch((err: BusinessError) => {
|
|
|
|
|
+ console.error(`Failed to activateAudioSession. Code: ${err.code}, message: ${err.message}`);
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ let isActivated = audioSessionManager.isAudioSessionActivated();
|
|
|
|
|
+ if(isActivated){
|
|
|
|
|
+ audioSessionManager.deactivateAudioSession().then(() => {
|
|
|
|
|
+ console.info('Succeeded in doing deactivateAudioSession.');
|
|
|
|
|
+ }).catch((err: BusinessError) => {
|
|
|
|
|
+ console.error(`Failed to deactivateAudioSession. Code: ${err.code}, message: ${err.message}`);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
if(this.volumeSmall){
|
|
if(this.volumeSmall){
|
|
|
this.volume = 0.5
|
|
this.volume = 0.5
|
|
|
}else{
|
|
}else{
|
|
@@ -13568,11 +13595,10 @@ export struct LocalMusic {
|
|
|
} else {
|
|
} else {
|
|
|
this.jumpTopTime = 0
|
|
this.jumpTopTime = 0
|
|
|
this.jumpEndTime = 0
|
|
this.jumpEndTime = 0
|
|
|
- console.error('onecold 最后一首: isFirstStartPlay = ' + this.isFirstStartPlay);
|
|
|
|
|
- console.error('onecold 最后一首: isMemoryLastPlay = ' + this.isMemoryLastPlay);
|
|
|
|
|
- console.error('onecold 最后一首: PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false) = ' +
|
|
|
|
|
- PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false));
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // console.error('onecold 最后一首: isFirstStartPlay = ' + this.isFirstStartPlay);
|
|
|
|
|
+ // console.error('onecold 最后一首: isMemoryLastPlay = ' + this.isMemoryLastPlay);
|
|
|
|
|
+ // console.error('onecold 最后一首: PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false) = ' +
|
|
|
|
|
+ // PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false));
|
|
|
//记忆播放(每一首都会记忆播放)
|
|
//记忆播放(每一首都会记忆播放)
|
|
|
if (StrUtil.isNotEmpty(this.videoUrl) && !this.videoUrl.toLowerCase().endsWith('.ts')) {
|
|
if (StrUtil.isNotEmpty(this.videoUrl) && !this.videoUrl.toLowerCase().endsWith('.ts')) {
|
|
|
setTimeout(() => { //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
|
|
setTimeout(() => { //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
|