Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

AVF context unavailable nothing happening #57

Open
Ajack123 opened this issue Apr 1, 2018 · 1 comment
Open

AVF context unavailable nothing happening #57

Ajack123 opened this issue Apr 1, 2018 · 1 comment

Comments

@Ajack123
Copy link

Ajack123 commented Apr 1, 2018

Hi there jpsim
While searching the Internet for a volume button handler I stumbled upon your code here.
I really need your code and tried to run it in Xcode but during simulation I get the following message:

2018-04-01 11:11:11.082845-0700 Buttons[11228:255620] [MediaRemote] [AVOutputContext] WARNING: AVF context unavailable for sharedAudioPresentationContext
2018-04-01 11:11:11.087537-0700 Buttons[11228:255620] [MediaRemote] [AVOutputContext] WARNING: AVF context unavailable for +[MRAVOutputContext createOutputContextWithUniqueIdentifier:]

I have to admit that I really do not know objective c but I was pretty sure that I did everything you've said.I've added the frameworks in my settings,too

#import "helloViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>
#import "SystemVolumeView.h"

#import "JPSVolumeButtonHandler.h" //here importer

@interface helloViewController ()

@Property (nonatomic,strong) JPSVolumeButtonHandler *volumeButtonHandler;// declared

@EnD

@implementation helloViewController

  • (void)viewDidLoad {
    [super viewDidLoad];

    [self.volumeButtonHandler stopHandler]; // just to make sure but also tried without this line
    [self.volumeButtonHandler startHandler:YES];

}

  • (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    }

  • (IBAction)showMessage //click button to see if it works then it should listen for button press
    {
    NSLog(@"Something");
    self.volumeButtonHandler = [JPSVolumeButtonHandler volumeButtonHandlerWithUpBlock:^{
    // Volume Up Button Pressed
    NSLog(@"Volume Up Button Pressed");

    } downBlock:^{
    // Volume Down Button Pressed
    NSLog(@"Volume Down Button Pressed");

    }];}

your code is very crucial for me. I've already implemented this feature for my android app version but I'm struggling with iOS. All other objective c codes on the internet are outdated. they worked until iOS 7.

Thanks in advance.

@jlippold
Copy link

Try this, it works for me:

- (void)viewDidLoad {
    self.volumeButtonHandler = [[JPSVolumeButtonHandler alloc] init];
    self.volumeButtonHandler = [JPSVolumeButtonHandler volumeButtonHandlerWithUpBlock:^{
        // Volume Up Button Pressed
        NSLog(@"UP");
    } downBlock:^{
        // Volume Down Button Pressed
        NSLog(@"Down");
    }];
    
    [self.volumeButtonHandler startHandler:YES];
    [self.volumeButtonHandler useExactJumpsOnly:YES];
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants