shiyiya/oplayer

Subtitle cors problem

Closed this issue ยท 1 comments

Environment

current version

๐Ÿ› Bug Report

The subtitles are having color problems, unlike the video which works perfectly.

To Reproduce

I did the default implementation, just include the following subtitle: https://od.lk/s/MjBfMzA2MTA2OThf/%5BErai-raws%5D%20Seishun%20Buta%20Yarou%20wa%20Bunny%20Girl%20Senpai%20no%20Yume%20wo%20Minai%20-%2001%20%5B720p%5D%5BMultiple%20Subtitle%5D_track5_por.ass

Link to repl or repo (highly encouraged)

I couldn't compile the project locally, but from what I saw in the code, you can change line 137 of the packages/ui/components/subtitle.ts file:

Before:
return fetch(src)
After:
return fetch(src, { mode: 'cors' })

I believe this should solve the problem.

image

@oplayer/ui@1.3.4-beta.0

{
  subtitle: {
    source: [{src:'', type: 'ass'}],
    onChange(source) {
      // custom fetch
      return (source) => fetch(source.src, { mode: 'cors' }).then((response) => response.text())
    }
  }
}

tips: ass style is not full support