can't load lyric file
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
When I try to load a lyric file as following
```javascript
const ap = new APlayer({
container: document.getElementById('aplayer'),
loop: 'all',
lrcType: 3,
autoplay: false,
listFolded: false,
listMaxHeight: 90,
audio: [
{
name: 'example',
artist: 'example',
url: 'example.mp3',
cover: 'example',
lrc: 'example.lrc',
theme: 'blue'
}]
});
```
I found that it did't work, it didn't show the lyric. I opened console and found an error occured. Here is the error information
```
APlayer.min.js:1
Access to XMLHttpRequest at 'file:///C:/Users/young/Desktop/mysite/example.lrc' from origin
'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol
schemes: http, data, chrome, chrome-extension, https.
```
So I tried to replace ```lrc: 'example.lrc'``` with ```http://localhost/exmaple.lrc``` to which I referred [https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local](https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local). Unfortunately, an other error happended.
```
APlayer.min.js:1
Access to XMLHttpRequest at 'http://localhost/letter_song.lrc' from origin 'null' has been blocked
by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.