Skip to content

Commit

Permalink
refact: remove poor code
Browse files Browse the repository at this point in the history
  • Loading branch information
heliomarpm committed Jul 7, 2024
1 parent af049b2 commit 6f9fd55
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/core/services/m3u8.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,12 @@ class M3U8Service {
* @throws {Error} - If the playlist fails to load after multiple attempts.
*/
async loadPlaylist(maxRetries = 3) {
try {
const playlistContent = await M3U8Service.getFile(this._m3u8Url, false, maxRetries);
if (!this._isValidM3U8Content(playlistContent)) {
throw new Error('Invalid M3U8 playlist content');
}
this._playlist = this._extractUrlsAndQualities(playlistContent);
return this._playlist;
} catch (e) {
throw e;
const playlistContent = await M3U8Service.getFile(this._m3u8Url, false, maxRetries);
if (!this._isValidM3U8Content(playlistContent)) {
throw new Error('Invalid M3U8 playlist content');
}
this._playlist = this._extractUrlsAndQualities(playlistContent);
return this._playlist;
}

/**
Expand Down

0 comments on commit 6f9fd55

Please sign in to comment.