Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTMP broadcasting when the app goes in background #184

Open
jsfan3 opened this issue Jul 18, 2020 · 2 comments
Open

RTMP broadcasting when the app goes in background #184

jsfan3 opened this issue Jul 18, 2020 · 2 comments

Comments

@jsfan3
Copy link

jsfan3 commented Jul 18, 2020

Thank you so much for your great library.
I tried to use it to make a live streaming: it works properly.

The moment the app goes into the background, however, the RTMP stream stops. What can I do to make the streaming continue even when the app goes in the background? When recording events, it is essential that the streaming is not accidentally interrupted by a phone call or another app.

Thank you for your support.

This is my code:

#import "net_informaticalibera_test_rmtpclient_RMTPBroadcastNativeImpl.h"
#import <GPUImage/GPUImage.h>
#import <libksygpulive/KSYGPUStreamerKit.h>
#import "CodenameOne_GLViewController.h"
#import "cn1_globals.h"
#import "com_codename1_io_Log.h"
#import "com_codename1_ui_CN.h"

@implementation net_informaticalibera_test_rmtpclient_RMTPBroadcastNativeImpl

KSYGPUStreamerKit* kit = nil;
NSURL* url = nil;
UIView* myView = nil;

-(void)startBroadcast{
    dispatch_sync(dispatch_get_main_queue(), ^{
        NSLog(@"Value of url = %@", url.absoluteString);
        [kit.streamerBase startStream:url];
    });
}

-(void)switchCamera{
    dispatch_sync(dispatch_get_main_queue(), ^{
        [kit switchCamera];
    });
}

-(void*)getCameraPreview:(NSString*)param{
    dispatch_sync(dispatch_get_main_queue(), ^{
        [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
        
        url = [[NSURL alloc] initWithString:param];
        CGSize size = [UIScreen mainScreen].bounds.size;
        myView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, size.width, size.height)];
        kit = [[KSYGPUStreamerKit alloc] initWithDefaultCfg];
        [kit startPreview:myView];
    });
    return myView;
}

-(void)stopBroadcast{
    dispatch_sync(dispatch_get_main_queue(), ^{
        [kit.streamerBase stopStream];
    });
}

-(BOOL)isSupported{
    return YES;
}

@end
@ducbm-belive
Copy link

hello, have you found the solution for this? I just met this issue :D Tks

@jsfan3
Copy link
Author

jsfan3 commented May 11, 2021

@ducbm-belive No, I didn't find a solution

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

No branches or pull requests

2 participants