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
#import "ViewController.h"
#import <AgoraRtcKit/AgoraRtcEngineKit.h>
@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.