PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, September 29, 2022

[FIXED] How to set volume control in tvOS app?

 September 29, 2022     ios, swift, tvos     No comments   

Issue

I am new to tvOS/iOS development. I am using swift. I am trying to develop a tvOS app. It plays 3 videos in a loop (which is basically 3 versions of same video at different speeds). It has a background music which can be turned on or off.

I have a pending functionality to implement- which is volume control for the background music. So I am not sure if we can use a Volume Slider in tvOS. But before that is it possible to increase and decrease the volume of the background music within the app alone? I mean, is there any way to not affect the main TV volume and still control the volume of the music alone inside the app?

I saw this apple documentation, but I am not sure how to use that. https://developer.apple.com/reference/avfoundation/avplayer/1390127-volume

I also looked at this thread: iPhone: Implement Volume control using buttons

Can this be used for tvOS too?

Can someone help me with this?


Solution

So, the solution was quite simple. I used var volume for performing this. Used two buttons. I gave an initial value and then wrote the logic inside an if block for changing the volumes on the respective button clicks (add volume by 0.1 and subtract volume by 0.1) :)



Answered By - BizDev
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing