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

如何在使用 Meting 后使用 APlayer 的 API #32

Open
LiarOnce opened this issue Mar 2, 2020 · 5 comments
Open

如何在使用 Meting 后使用 APlayer 的 API #32

LiarOnce opened this issue Mar 2, 2020 · 5 comments

Comments

@LiarOnce
Copy link

LiarOnce commented Mar 2, 2020

使用 APlayer 提供的范例引用的话会无法加载。

@wertasy
Copy link

wertasy commented Mar 4, 2020

像这样:document.querySelector('meting-js').aplayer.play();

@LiarOnce
Copy link
Author

LiarOnce commented Mar 4, 2020

@wertasy 感谢回复,但因为兼容性原因只能使用 1.2.0,如果是 1.2.0 的请问应该怎样使用?

@lim8639
Copy link

lim8639 commented Feb 5, 2021

直接改Metingjs,把设置传进去

@scillidan
Copy link

scillidan commented Feb 6, 2021

aplayer的部分照旧使用。这样写
html部分

<div id="aplayer1"></div>
<div id="aplayer2"></div>

js部分

const ap1 = new APlayer({
    container: document.getElementById('aplayer1'),
    autoplay: false,
    preload: 'none',
    listFolded: true,
    audio: [{
        name: '',
        artist: '',
        url: '',
        cover: '.webp',
        theme: '#baa087',
    }, {}]
});

metingjs的部分,在html这样写

<div class="aplayer" data-id="1292139283" data-server="xiami" data-type="playlist" data-list-folded="true" data-preload="none" data-audio-cover=".webp">

@lp516357752
Copy link

提供一种个人可用的Vue版本的解决方法
`export default {
name: "MusicPlayer",
components: {

},
data() {
return {
player: null
}
},

mounted() {
this.$refs.player.addEventListener("DOMNodeInserted", this.getPlayer)
},
methods: {
getPlayer(e) {
//重点所在
this.$nextTick( () =>{
this.player = this.$refs.player.aplayer;//this.$refs.player就是meting标签元素
this.player.setMode("normal");
})
this.$refs.player.removeEventListener("DOMNodeInserted", this.getPlayer)
}
}
}`

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

5 participants