问题
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