如何获取安卓mediaplayer播放的DataSource
时间: 2024-04-25 09:24:13 浏览: 29
回答: 要获取Android MediaPlayer播放的数据源(DataSource),可以使用getDataSource()方法。这个方法可以在MediaPlayer对象上调用,无论是通过new MediaPlayer()创建的还是通过MediaPlayer.create()创建的。例如,如果您使用new MediaPlayer()创建了一个MediaPlayer对象,您可以在适当的时候调用getDataSource()方法来获取当前的数据源。同样地,如果您使用MediaPlayer.create()创建了一个MediaPlayer对象,您也可以在适当的时候调用getDataSource()方法来获取数据源。请注意,getDataSource()方法返回的是一个字符串,表示当前的数据源。\[1\]\[2\]
#### 引用[.reference_title]
- *1* *2* *3* [android使用MediaPlayer播放raw目录下的mp3](https://blog.csdn.net/set_one_name/article/details/130624586)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)