How to run multiple tracks at a time / simultaneously in react-native?

旧时模样 提交于 2020-05-14 12:50:25

问题


Describe the bug:

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?

Expected behavior: Play the multiple songs at a time

Platform: Android


回答1:


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();


来源:https://stackoverflow.com/questions/61708473/how-to-run-multiple-tracks-at-a-time-simultaneously-in-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!