Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The player cannot adjust the number and size of lines displayed in the lyrics, only one or two lines can be viewed播放器无法调整歌词显示的行数和大小,只能看一两行 #783

Closed
RickyWang111 opened this issue Oct 19, 2023 · 2 comments

Comments

@RickyWang111
Copy link

The player cannot adjust the number and size of lines displayed in the lyrics, only one or two lines can be viewed
播放器无法调整歌词显示的行数和大小,只能看一两行
I tried the lrcType: 2 method, but the lyrics were not recognized by the player after being placed in HTML. It is completely copied from the instruction document:
我尝试了lrcType: 2的方式,把歌词放在html中后并没有被播放器识别。完全是复制的说明文档里的:


HTML 方式
第三种方式,把歌词放到 HTML 里面。

<link rel="stylesheet" href="APlayer.min.css">
<div id="player">
    <pre class="aplayer-lrc-content">
        [00:00.00]APlayer audio1
        [00:04.01]is
        [00:08.02]amazing
        <!-- ... -->
    </pre>
    <pre class="aplayer-lrc-content">
        [00:00.00]APlayer audio2
        [00:04.01]is
        [00:08.02]amazing
        <!-- ... -->
    </pre>
</div>
<script src="APlayer.min.js"></script>
const ap = new APlayer({
    container: document.getElementById('aplayer'),
    lrcType: 2,
    audio: [[
        {
            name: 'name1',
            artist: 'artist1',
            url: 'url1.mp3',
            cover: 'cover1.jpg'
        },
        {
            name: 'name2',
            artist: 'artist2',
            url: 'url2.mp3',
            cover: 'cover2.jpg'
        }
    ]]
});
@RickyWang111
Copy link
Author

RickyWang111 commented Oct 19, 2023

Here is my code:
以下是我的代码:

<link rel="stylesheet" href="/static/css/APlayer.min.css">
<script src="/static/js/APlayer.min.js"></script>

<div>
  <table>
    <tr>
      <td style="text-align: center;">啊啊啊</td>
      <td>
        <div id="aplayer" style="width: 100%;margin:auto,height:600px;"></div></td>
      <td style="text-align: center;"> 

        <div id="player">
          <pre class="aplayer-lrc-content">
              [00:00.00]APlayer audio1
              [00:04.01]is
              [00:08.02]amazing
              <!-- ... -->
          </pre>
          <pre class="aplayer-lrc-content">
              [00:00.00]APlayer audio2
              [00:04.01]is
              [00:08.02]amazing
              <!-- ... -->
          </pre>
      </div>
      
      </td>
    </tr>
  </table>
</div>

<script>
const ap = new APlayer({
    container: document.getElementById('aplayer'),
    lrcType: 1,
    audio: [{
        name: '雨后',
        artist: '123',
        url: 'http://s-cd-7880-music.oss.dogecdn.com/100001.mp3',
        cover: '/static/img/logo73.jpg',
    },{
        name: '老去',
        artist: '123',
        url: 'url.mp3',
        cover: '/static/img/logo73.jpg'
    },
  ]
});
ap.on('play', function (e) {
  console.log(e);
  if(ap.list.audios[ap.list.index].name=="雨后"){

  }
  ;
})
</script>

page display
页面显示:

image

@RickyWang111
Copy link
Author

RickyWang111 commented Oct 19, 2023

我解决了部分问题。
说明文档里面的id="player" 少了个a
应该是id="aplayer"

但是歌词只能显示1-2行,希望能改进为显示10行,播放器歌词部分显示多点,这样听众可以多看看歌词上下文
image

或者可以把歌词部分自定义到任意位置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant