【发布时间】:2019-09-06 02:42:49
【问题描述】:
我正在 React Native 博览会中实现一个媒体播放器。我已经设计了我的播放器、播放歌曲、下一首和上一首歌曲功能,但我在获取歌曲的持续时间时遇到了问题,以便能够使用进度条显示歌曲的进度。
我已经通过https://docs.expo.io/versions/latest/sdk/audio/ 并没有找到任何关于如何获取文件的持续时间或如何获取任何可以帮助我实现进度条的信息。任何想法都非常受欢迎。
我正在试验的代码:
// Create new object from Expo.Audio.Sound
this.soundObject = new Audio.Sound();
await this.soundObject.loadAsync(url);
await this.soundObject.playAsync();
getCurrentItemArtistName = ()=> {
return this.list[this.index].artistname;
};
getCurrentItemCover = ()=> {
return this.list[this.index].cover;
};
提前谢谢你
【问题讨论】:
-
到目前为止你有这个吗?世博会音频适合您吗?
标签: react-native audio expo