Développement iOS-Démo Agora

Préface

  • Acoustic network Agora est un SDK payant pour la vidéo en direct similaire à Qiniu Cloud et Tencent Cloud récemment. La démo sur le site officiel n'est pas très facile à comprendre, donc ce qui suit est un exemple.

Préparation au développement

  • importation de podfile
    pod 'AgoraRtcEngine_iOS'

Code

  • ViewController.m
#import "ViewController.h"
#import <AgoraRtcKit/AgoraRtcEngineKit.h> //声网SDK

@interface ViewController () <AgoraRtcEngineDelegate>

@property(nonatomic, strong) AgoraRtcEngineKit *agoraKit;

@end

@implementation ViewController

- (void)viewDidLoad {
    
    
    [super viewDidLoad];
    [self.agoraKit startPreview]; //开始预览本地视频
}

#pragma mark - agoraKit

- (AgoraRtcEngineKit *)agoraKit {
    
    
    if(_agoraKit == nil) {
    
    
        _agoraKit = [AgoraRtcEngineKit sharedEngineWithAppId:@"your key" delegate:self];
        
        [_agoraKit enableVideo];
        
        AgoraRtcVideoCanvas *videoCanvas = [[AgoraRtcVideoCanvas alloc] init];
        videoCanvas.view = self.view;
        videoCanvas.renderMode = AgoraVideoRenderModeHidden;
        [_agoraKit setupLocalVideo:videoCanvas];
    }
    return _agoraKit;
}

- (void)setCameraFront {
    
     // 设置前置摄像头
    AgoraCameraCapturerConfiguration *configuration = [[AgoraCameraCapturerConfiguration alloc]init];
    configuration.cameraDirection = AgoraCameraDirectionFront;
    [self.agoraKit setCameraCapturerConfiguration:configuration];
}

@end

À propos d'autres documents détaillés

  • Document du site officiel
    • Rappel de la première image de notre soirée et de l'autre partie
    • Rappel pour couper le son
    • Comment démarrer la vidéo, etc.

Je suppose que tu aimes

Origine blog.csdn.net/weixin_41732253/article/details/110287622
conseillé
Classement