PLEASE JUST FUCKING WORK WHAT
This commit is contained in:
parent
d0fff02e64
commit
6fd334f74d
1 changed files with 17 additions and 23 deletions
40
js/player.js
40
js/player.js
|
|
@ -109,23 +109,19 @@ export class Player {
|
||||||
this._setupVideoSync();
|
this._setupVideoSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
_resetDashPlayer() {
|
_resetDashPlayer() {
|
||||||
if (this.dashInitialized && this.dashPlayer) {
|
if (this.dashInitialized && this.dashPlayer) {
|
||||||
try {
|
try { this.dashPlayer.attachView(null); } catch (e) {}
|
||||||
this.dashPlayer.attachView(null);
|
try { this.dashPlayer.destroy(); } catch (e) {}
|
||||||
} catch (e) {}
|
this.dashPlayer = MediaPlayer().create();
|
||||||
try {
|
this.dashPlayer.updateSettings({
|
||||||
this.dashPlayer.destroy();
|
streaming: {
|
||||||
} catch (e) {}
|
buffer: { fastSwitchEnabled: true },
|
||||||
this.dashPlayer = MediaPlayer().create();
|
},
|
||||||
this.dashPlayer.updateSettings({
|
});
|
||||||
streaming: {
|
this.dashInitialized = false;
|
||||||
buffer: { fastSwitchEnabled: true },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
this.dashInitialized = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_setupVideoSync() {
|
_setupVideoSync() {
|
||||||
if (!this.video || !this.audio) return;
|
if (!this.video || !this.audio) return;
|
||||||
|
|
||||||
|
|
@ -902,10 +898,7 @@ export class Player {
|
||||||
console.error('DashPlayer initialize failed for audio:', e);
|
console.error('DashPlayer initialize failed for audio:', e);
|
||||||
throw new Error('DASH initialization failed');
|
throw new Error('DASH initialization failed');
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (streamUrl && (streamUrl.includes('.m3u8') || streamUrl.includes('application/vnd.apple.mpegurl'))) {
|
||||||
streamUrl &&
|
|
||||||
(streamUrl.includes('.m3u8') || streamUrl.includes('application/vnd.apple.mpegurl'))
|
|
||||||
) {
|
|
||||||
this.setupHlsVideo(activeElement, streamUrl, null);
|
this.setupHlsVideo(activeElement, streamUrl, null);
|
||||||
this.applyAudioEffects();
|
this.applyAudioEffects();
|
||||||
|
|
||||||
|
|
@ -1070,8 +1063,9 @@ export class Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
const shuffledSeeds = [...this.radioSeeds].sort(() => 0.5 - Math.random());
|
const shuffledSeeds = [...this.radioSeeds].sort(() => 0.5 - Math.random());
|
||||||
const seeds =
|
const seeds = shuffledSeeds.length > 0
|
||||||
shuffledSeeds.length > 0 ? shuffledSeeds.slice(0, 5) : this.currentTrack ? [this.currentTrack] : [];
|
? shuffledSeeds.slice(0, 5)
|
||||||
|
: this.currentTrack ? [this.currentTrack] : [];
|
||||||
|
|
||||||
if (seeds.length === 0) {
|
if (seeds.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1090,7 +1084,7 @@ export class Player {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const recommendations = await this.api.getRecommendedTracksForPlaylist(seeds, 20, {
|
const recommendations = await this.api.getRecommendedTracksForPlaylist(seeds, 20, {
|
||||||
knownTrackIds: knownTrackIds,
|
knownTrackIds: knownTrackIds
|
||||||
});
|
});
|
||||||
|
|
||||||
if (recommendations && recommendations.length > 0) {
|
if (recommendations && recommendations.length > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue