Dibz
Dibz

Reputation: 11

How do i add the option to mute/unmute and the option of playback on AVPlayer Swift

Im having an issue where once the View loads the video starts playing automatically as intended but the user doesn't have the option to mute the video. How do you add the option to mute/unmute and have the playback option on the video itself. Heres a snippet of my code

Upvotes: 0

Views: 1059

Answers (1)

SomeoneAlt-86
SomeoneAlt-86

Reputation: 67

You can use AVplayer's volume property to control the audio. Setting it's value to 0 will mute the audio, you can also use isMuted=true to mute

More about that here https://developer.apple.com/documentation/avfoundation/avplayer/1390127-volume

Upvotes: 1

Related Questions