mirror of
https://gitlab.com/vyla-entertainment/TV.git
synced 2026-11-20 06:57:22 -05:00
ported sdk and this works
This commit is contained in:
17
js/player.js
17
js/player.js
@@ -129,13 +129,7 @@ function buildProxyUrl(rawUrl, headersObj = {}) {
|
||||
}
|
||||
|
||||
async function fetchSources() {
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/sources`);
|
||||
const data = await res.json();
|
||||
currentSources = data.sources || [];
|
||||
} catch (_) {
|
||||
currentSources = [];
|
||||
}
|
||||
currentSources = Vyla.sources();
|
||||
}
|
||||
|
||||
async function startConcurrentDiscovery(it, s = null, e = null) {
|
||||
@@ -153,10 +147,8 @@ async function startConcurrentDiscovery(it, s = null, e = null) {
|
||||
if (session !== discoverySession) return;
|
||||
|
||||
const sourcePromises = currentSources.map(async (src) => {
|
||||
let epQuery = s && e ? `&season=${s}&episode=${e}` : '';
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/stream?provider=${src.key}&tmdbId=${it.id}${epQuery}`);
|
||||
const data = await res.json();
|
||||
const data = await Vyla.stream(src.key, it.id, s, e);
|
||||
if (session !== discoverySession) return;
|
||||
|
||||
if (data.success && data.stream) {
|
||||
@@ -287,10 +279,7 @@ async function loadSubtitles(id, s, e) {
|
||||
activeSubtitles = [];
|
||||
|
||||
try {
|
||||
let epQuery = s && e ? `&season=${s}&episode=${e}` : '';
|
||||
const res = await fetch(`${API_BASE}/api/subtitles?tmdbId=${id}${epQuery}`);
|
||||
const data = await res.json();
|
||||
activeSubtitles = data.subtitles || [];
|
||||
activeSubtitles = await Vyla.subtitles(id, s, e);
|
||||
|
||||
activeSubtitles.forEach((sub, idx) => {
|
||||
const track = document.createElement('track');
|
||||
|
||||
Reference in New Issue
Block a user