How to check a video has sound or not in Android?

这一生的挚爱 提交于 2019-12-11 14:36:30

问题


I am using a TextureView with a MediaPlayer to play an mp4 video from a url. Is there any way I can programatically check if the video I am playing has sound?

Edit: I'm using API 14, so I don't have access to the MediaPlayer method getTrackInfo

Many Thanks


回答1:


In API level 16 or later, the MediaPlayer class has a getTrackInfo method that returns a TrackInfo[]. You could then call getTrackType for each element in the array and see if you get MEDIA_TRACK_TYPE_AUDIO.



来源:https://stackoverflow.com/questions/31606331/how-to-check-a-video-has-sound-or-not-in-android

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