aws-samples / amazon-chime-react-native-demo

A React Native demo application for Android and iOS using the Amazon Chime SDK.
MIT No Attribution
102 stars 24 forks source link

How to implement background blur in React Native Demo app for IOS #154

Open ashirkhan94 opened 2 years ago

ashirkhan94 commented 2 years ago

Hi, Can you give an example for implementing background blur on the amazon-chime-react-native-demo app in ios?. I have not much knowledge of objective c. thanks in advance

hokyungh commented 2 years ago

Hi I can add the feature request for now, but to unblock you sooner, you might want to translate https://github.com/aws/amazon-chime-sdk-ios/blob/master/guides/background_video_filters.md#implementing-background-blur-in-your-application into objective c.

AliBaig-xD commented 1 year ago

can you show me the necessary imports. I have integrated AmazonChimeSDKMachineLearning in my app and am importing the necessary headers #import <AmazonChimeSDKMachineLearning/cwt.h> but on creating instances for the classes below I get not found. What else do I need to import. BackgroundBlurVideoFrameProcessor BackgroundReplacementVideoFrameProcessor BackgroundBlurConfiguration

Here's a list of my complete imports

import "NativeMobileSDKBridge.h"

import <AVFoundation/AVFoundation.h>

import "RNVideoViewManager.h"

import <AmazonChimeSDKMedia/AmazonChimeSDKMedia.h>

import "MeetingObservers.h"

import <React/RCTUIManager.h>

import <BackgroundTasks/BackgroundTasks.h>

import <Foundation/Foundation.h>

import <React/RCTBridgeModule.h>

import <React/RCTEventEmitter.h>

import <AmazonChimeSDK/AmazonChimeSDK-Swift.h>

AlkanV commented 1 year ago

hello @hokyungh, i tried to convert that swift code into obj-c but i could not managed to do it. could you please help me on this?

below you can find my code piece.

RCT_EXPORT_METHOD(setBackgroundBlur:(BOOL)isOn)
{
  logger = [[ConsoleLogger alloc] initWithName:@"NativeMobileSDKBridge" level:LogLevelDEFAULT];

  BackgroundBlurConfiguration *backgroundBlurConfigurations = [[BackgroundBlurConfiguration alloc] initWithLogger:[[ConsoleLogger alloc] initWithName:@"BackgroundBlurProcessor"] blurStrength:BackgroundBlurStrengthLow];
  BackgroundBlurVideoFrameProcessor *backgroundBlurVideoFrameProcessor = [[BackgroundBlurVideoFrameProcessor alloc] initWithBackgroundBlurConfiguration:backgroundBlurConfigurations];

  DefaultCameraCaptureSource *cameraCaptureSource = [[DefaultCameraCaptureSource alloc] initWithLogger:[[ConsoleLogger alloc] initWithName:@"DefaultCameraCaptureSource"]];

  // Add the background blur processor as sink to the video source (e.g. `DefaultCameraCaptureSource`)
  [cameraCaptureSource addVideoSinkWithSink:backgroundBlurVideoFrameProcessor];

  // Use background blur processor as source
  [meetingSession.audioVideo startLocal:backgroundBlurVideoFrameProcessor];
}

as well as i dont know what to import on this bridge file, could you please help?

thank you,

a