Content sharing on amazon ios sdk for android not updating VideoTileDidAdd - ios

I have implemented content sharing using Amazon Chime's SDK for ios. The screen is shared when I invoke the setContentSharing(true) but there is no video tile added to my application. When I navigate to some other screen after turning screen sharing on and come back to the original then only screen is shared. Here Is the function I am using to invoke contentSharing
RCT_EXPORT_METHOD(setContentSharing:(BOOL)isOn)
{
if (meetingSession == nil) {
return;
}
if (#available(iOS 11.0, *)) {
if (isOn)
{
MeetingObservers* observerContent = [[MeetingObservers alloc] initWithBridge:self logger:logger];
[meetingSession.audioVideo addContentShareObserverWithObserver:observerContent];
[meetingSession.audioVideo addVideoTileObserverWithObserver:observerContent];
contentShareSource = [[ContentShareSource alloc] init];
contentShareSource.videoSource = inAppScreenCaptureSource;
[inAppScreenCaptureSource start];
[meetingSession.audioVideo startContentShareWithSource:contentShareSource];
}
else
{
[inAppScreenCaptureSource stop];
[meetingSession.audioVideo stopContentShare];
[self sendEventWithName:kEventOnScreenSharingStop body:nil];
}
}
}
I have tried implementing content sharing in my IOS app but the video stream for the screen doesn't get rendered on my application. I have to navigate to other screen and navigate back to get the video tile rendered on my app

Related

iOS 13: MPMediaPickerController - Internal Error / The requested app extension could not be found

It seems that the general MPMediaPicker is not working anymore on ios13 (ipad air 2, iphone SE)
The example 1:1 copied from there is not showing up the media picker
https://developer.apple.com/documentation/mediaplayer/displaying_a_media_picker_from_your_app
Any tips how to get back functionality??
Note 1
When using using the MPMediaPickerController like this
musicPickerView = [[UIView alloc] initWithFrame:fullScreenRect];
musicPickerView.alpha = 0.0f;
musicPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
musicPicker.showsCloudItems = false;
musicPicker.showsItemsWithProtectedAssets = false;
musicPicker.delegate = self;
musicPicker.allowsPickingMultipleItems = false;
musicPicker.prompt = NSLocalizedString(#"Select a song", #"Select a song");
musicPicker.view.frame = musicPickerView.bounds;
[self addChildViewController:musicPicker];
[musicPickerView addSubview:musicPicker.view];
[self.view addSubview:musicPickerView];
[musicPicker didMoveToParentViewController:self];
[self fadeInMusicPicker:true];
The delegate is not invoked at all. No log is shown, only the native alert.
I am getting this native altert
Internal Error
The requested app extension could not be found
[Cancel]
Note 2
It seems to be the issue when the apple music app is not installed on that device. Does anybody know a reliable way to find out if apple music app is installed?
It seems that the Music app from apple has to be installed on that device. Still not 100% reproducible, but with that app installed, I never saw that issue again.
did you set the permission for the Media Library in your info.plist?
NSAppleMusicUsageDescription
From iOS 13 MPMediaPicker required user authorization, unlike the earlier iOS version. So you need to handle the authentication first and then show the picker if user granted the permission. You code will be as follow,
MPMediaLibraryAuthorizationStatus authorizationStatus = MPMediaLibrary.authorizationStatus;
switch (authorizationStatus)
{
case MPMediaLibraryAuthorizationStatusAuthorized:
{
[self showPickerView];
break;
}
case MPMediaLibraryAuthorizationStatusNotDetermined:
{
// Not yet authorized - request it from the system
[MPMediaLibrary requestAuthorization:^(MPMediaLibraryAuthorizationStatus authorizationStatus)
{
if ( authorizationStatus == MPMediaLibraryAuthorizationStatusAuthorized )
{
dispatch_async(dispatch_get_main_queue(), ^{
[self showPickerView];
});
}
else
{
PLog(#"The Media Library was not authorized by the user");
}
}];
break;
}
case MPMediaLibraryAuthorizationStatusRestricted:
case MPMediaLibraryAuthorizationStatusDenied:
{
// user has previously denied access. Ask again with our own alert that is similar to the system alert
// then take them to the System Settings so they can turn it on for the app
break;
}
}
-(void)showPickerView
{
musicPickerView = [[UIView alloc] initWithFrame:fullScreenRect];
musicPickerView.alpha = 0.0f;
musicPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
musicPicker.showsCloudItems = false;
musicPicker.showsItemsWithProtectedAssets = false;
musicPicker.delegate = self;
musicPicker.allowsPickingMultipleItems = false;
musicPicker.prompt = NSLocalizedString(#"Select a song", #"Select a song");
musicPicker.view.frame = musicPickerView.bounds;
[self addChildViewController:musicPicker];
[musicPickerView addSubview:musicPicker.view];
[self.view addSubview:musicPickerView];
[musicPicker didMoveToParentViewController:self];
[self fadeInMusicPicker:true];
}

Creating a VR app using DJI SDK

I'm creating a VR app using the DJI SDK.
I have two UIViews, fpvPreviewView1 and fpvPreviewView2.
How do I create two instances of the same camera? It currently only displays in a single view.
Here's the relevant code.
DJICamera *camera = [self fetchCamera];
if (camera && camera.delegate == self)
[camera setDelegate:nil];
[self resetVideoPreview];
- (DJICamera*) fetchCamera {
if (![DJISDKManager product]) {
return nil;
}
if ([[DJISDKManager product] isKindOfClass:[DJIAircraft class]]) {
return ((DJIAircraft*)[DJISDKManager product]).camera;
}else if ([[DJISDKManager product] isKindOfClass:[DJIHandheld class]]){
return ((DJIHandheld *)[DJISDKManager product]).camera;
}
return nil;
}
[[VideoPreviewer instance] setView:self.fpvPreviewView1];
[[VideoPreviewer instance] setView:self.fpvPreviewView2];
[[VideoPreviewer instance] setView:self.fpvPreviewView1];
[[VideoPreviewer instance] setView:self.fpvPreviewView2];
Time sensitive. Please help!
Thanks!
What you are currently doing is reset the view of the video previewer singleton every time.
What you want to do is create multiple instances of VideoPreviewer and keep a reference to manage properly the resources. VideoPreviewer is heavy.
Try this instead:
self.firstVP = [[VideoPreviewer alloc] init];
[self.firstVP setView:self.fpvPreviewView1];
self.secondVP = [[VideoPreviewer alloc] init];
[self.secondVP setView:self.fpvPreviewView2];
Hope this helps.

Not seeing the "Connected to iAd" popups on my app

I am in the process of making an iOS app (Objective-C), I am nearing the end of my production of the application itself and now I am trying to implements Interstitial Ads. I was before seeing the Blue You are connected to iAd banners before on my app but I do not seem to see them now. My test device (iPhone 5S, iOS 9.2.1) is connected to the internet, so that is not the issue and the account I am using is a free developer account, not a paid one.
Below is code from one of my view controllers (the code is identical on all three of them with regard to iAd), I got the code from Apple's test project and modified it slightly.
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self cycleInterstitial];
// Other non-relavent stuff
}
- (void)like: (UIButton*)button {
// Other non-relavent stuff
NSInteger i = arc4random_uniform(3);
if (i == 2) {
[self presentInterlude];
}
}
- (void)cycleInterstitial {
// Clean up the old interstitial...
NSLog(#"Cycling");
self.inter.delegate = nil;
// and create a new interstitial. We set the delegate so that we can be notified of when
self.inter = [[ADInterstitialAd alloc] init];
self.inter.delegate = self;
}
- (void)presentInterlude {
// If the interstitial managed to load, then we'll present it now.
if (self.inter.loaded) {
NSLog(#"Requesting the ad");
[self requestInterstitialAdPresentation];
}
}
- (void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd {
[self cycleInterstitial];
}
- (void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error {
[self cycleInterstitial];
}
I know it is not my random number as I removed that previously. Any ideas on why my ads are not showing up? Could it be my code, my non-paid developer account, or is it something else?
I am not trying to display an actual ad I am only trying to get that You are connected to iAd popup to display to confirm that my implementation is working, so it should not be the fact that I am using a non-paid developer account.

How to add: "Open With" other apps option in UIWebview when viewing Documents (iOS Swift)

I was wondering if anyone could show me what code I need to implement to make my webview present options when viewing a document. Currently now I have a simple View controller with a webView taking up the entire view. It works fine and can display the documents but thats it. Shown below is an image from the safari iOS App that has the functionality I'm looking for.
Image Link: http://imgur.com/Nt1qIBB/
(Because I don't have enough reputation to upload image.. : /
Any help will be greatly appreciated. The tutorials I come across only show how to make the UIWebView work and it stops just about there.
-when you top long time on you web view and show "open in..." button on the top of web view.
click it then show like this:
- (void)SetmyParentViewController:(id)pViewController
{
if (nil != pmyParentViewController) {
}
self.pmyParentViewController = (UIViewController *)pViewController;
}
- (BOOL)SelectAppToOpenFile:(NSURL *)aUrl;
{
if (nil == pDocInteractCtrl) {
self.pDocInteractCtrl = [UIDocumentInteractionController interactionControllerWithURL:aUrl];
pDocInteractCtrl.delegate = (id)self.pmyParentViewController;
} else {
[pDocInteractCtrl setURL:aUrl];
}
if ([pDocInteractCtrl presentOpenInMenuFromRect:viewRect inView:pmyParentViewController.view animated:YES]) {
return YES;
}
else {
return NO;
}
}

Open Game Center UI with Cocos2d-x

I have set up so that my app can connect to the Game Center. I followed this guide and had a C++ class wrapper to call them in my other classes. I'm using iPad (iOS 5.1), iPod Touch 4th Gen (iOS 5.1), and iPhone 4s and 3GS to test. It works fine on iPad devices but for some unknown reason, it does not on iPhone and iPod. It properly connects to the Sandbox but the UI is not shown, or rather, the UI is somewhere off-screen.
What happens on the iPhone is:
If I'm not logged in and I access the Game Center, a login window appears. When I log in, nothing happens. However, the console says a view is added.
If I'm logged in and I access the Game Center, nothing happens. However, the console says a view is added.
If I access the Game Center before I get authenticated, the Game Center UI appears. However...
The Game Center is in Landscape Mode (no problem there, since my app is in landscape) but the top bar (the bar with the DONE button) is placed as if the orientation is portrait.
The whole UI is not shown, just ~30% of the screen.
This is how I launch the Game Center UI:
- (void)showLeaderboardForCategory:(NSString *)category
{
// Only execute if OS supports Game Center & player is logged in
if ( hasGameCenter )
{
// Create leaderboard view w/ default Game Center style
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
// If view controller was successfully created...
if (leaderboardController != nil)
{
// Leaderboard config
leaderboardController.leaderboardDelegate = self; // The leaderboard view controller will send messages to this object
leaderboardController.category = category; // Set category here
leaderboardController.timeScope = GKLeaderboardTimeScopeToday; // GKLeaderboardTimeScopeToday, GKLeaderboardTimeScopeWeek, GKLeaderboardTimeScopeAllTime
// Create an additional UIViewController to attach the GKLeaderboardViewController to
myViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil ];
// Add the temporary UIViewController to the main OpenGL view
// NOTE: This is the part that I think is the suspect. I am not sure if iPhones and iPods support EAGLView.
[ [ EAGLView sharedEGLView ] addSubview:myViewController.view ];
// Tell UIViewController to present the leaderboard
[ myViewController presentModalViewController:leaderboardController animated:NO ];
NSLog( #"Leaderboard opened." );
}
}
}
Any help is appreciated and thanks in advance.
EDIT: Using OpenFeint is not an option.
Try this.Do not use 'EAGLView'
- (void) showLeaderboard
{
if (!gameCenterAvailable) return;
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil) {
leaderboardController.leaderboardDelegate = self;
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
currentModalViewController = [[UIViewController alloc] init];
[window addSubview:currentModalViewController.view];
[currentModalViewController presentModalViewController:leaderboardController animated:YES];
}
}

Resources