Skip to content

Commit

Permalink
fix: 🐛 播放失败问题
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer95 committed Jun 11, 2022
1 parent bfa9221 commit 97b5590
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .umirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// ref: https://umijs.org/config/
export default {
define: {
'process.env.VERSION': 'V1.5.3',
'process.env.VERSION': 'V1.5.4',
'process.env.APPNAME': 'FA FOREVER',
'process.env.APIHOST': 'http://faforever.eqistu.cn/',
},
Expand Down
2 changes: 1 addition & 1 deletion note.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[新功能] 2022-03-03 安卓电视端测试版发布~ 2022-02-24:喜欢歌曲上线
播放失败,可能是下载歌曲失败了。需要到缓存目录删除歌曲
6 changes: 3 additions & 3 deletions src/components/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class Criteria extends React.Component {
this.setState({ downloading: false });

if (this.props.music.url) {
message.error(`播放失败。Error :${JSON.stringify(error)}`);
message.error(`播放失败。尝试重新下载播放`);
setTimeout(() => {
this.props.music.playNext(this.props.mode);
}, 5000);
this.props.music.play(this.props.music.song, true);
}, 100);
}
});

Expand Down
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function createWindow() {
// Open the DevTools.
mainWindow.webContents.openDevTools();
} else {
if (process.env.FA_NODE_ENV === 'preview') mainWindow.webContents.openDevTools();
mainWindow.loadURL(`http://cdn.eqistu.cn/faforever13/index.html?t=${new Date().valueOf()}`);
}
// and load the index.html of the app.
Expand Down
14 changes: 9 additions & 5 deletions src/stores/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,13 @@ class Store {

loadCriteria = flow(function*() {
this.loading = true;
const { data: sidData } = yield getSid();
console.log('sidData', sidData);
this.loginsid = sidData.sid;
const res = yield login();
if (res.data.success) {
this.loginsid = res.data.data.sid;
} else {
const { data: sidData } = yield getSid();
this.loginsid = sidData;
}
const { data } = yield getEntryNew();
console.log(data);
this.criteria = data;
Expand Down Expand Up @@ -260,7 +264,7 @@ class Store {
}
};

@action play = song => {
@action play = (song, recache = false) => {
if (!ipcRenderer) {
message.error('因DS服务器资源有限,不允许在线播放噢!');
return;
Expand Down Expand Up @@ -288,7 +292,7 @@ class Store {
this.loadLrc(lrcurl, song.title);
const cachePath = localStorage.getItem('cache-path');

if (cache && cache.exist(cacheKey, cachePath)) {
if (cache && cache.exist(cacheKey, cachePath) && !recache) {
this.url = 'file://' + cache.path(cacheKey, cachePath);
} else {
this.url = download(song.id, this.loginsid);
Expand Down

0 comments on commit 97b5590

Please sign in to comment.