如何在 react-native 中一次/同时运行多个轨道? [英] How to run multiple tracks at a time / simultaneously in react-native?

查看:40
本文介绍了如何在 react-native 中一次/同时运行多个轨道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

描述错误:

我在我的应用程序中使用 react-native,我想一次播放多首曲目.我尝试了一些节点模块,但它们一次只允许我播放一首歌.有没有办法做到这一点?

I'm using react-native in my application, I want to play the multiple tracks at a time. I tried some node modules but they only allows me to play a song at a time. Is there any way to do this?

预期行为:一次播放多首歌曲

平台:安卓

推荐答案

这可以通过 react-native-audio-toolkit 模块.您可以同时创建多个 Player 实例并播放多个曲目.

This could be possible with react-native-audio-toolkit module. You could create multiple Player instance at same time and play multiple tracks.

import {Player} from '@react-native-community/audio-toolkit';

const PLAYER_ONE = new Player(songUrl1).play();
const PLAYER_TWO = new Player(songUrl2).play();

这篇关于如何在 react-native 中一次/同时运行多个轨道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆