>  기사  >  Java  >  ZEGOCLOUD로 영상 통화 앱을 만드는 방법

ZEGOCLOUD로 영상 통화 앱을 만드는 방법

DDD
DDD원래의
2024-09-25 06:24:07682검색

How to Make a Video Call App with ZEGOCLOUD

나만의 영상통화 앱을 만들고 싶으신가요? ZEGOCLOUD 덕분에 생각보다 쉽습니다. 이 가이드에서는 화상 통화 앱을 단계별로 구축하는 방법을 보여줍니다. ZEGOCLOUD는 앱 개발이 처음인 경우에도 프로세스를 단순화하는 도구를 제공합니다.

프로젝트를 설정하고, 영상 통화 기능을 추가하고, 앱을 원활하게 실행하는 방법을 배우게 됩니다. ZEGOCLOUD 시작부터 완성된 앱 테스트까지 알아야 할 기본 사항을 다룹니다. 마지막에는 여러분이 직접 구축하여 작동하는 영상 통화 앱을 갖게 될 것입니다.

초심자이든 코딩 경험이 있는 사람이든 이 가이드는 ZEGOCLOUD를 사용하여 영상 통화 앱을 빠르고 쉽게 만드는 데 도움이 될 것입니다.

앱을 만드는 데 얼마나 걸리나요?

앱을 만드는 데는 시간이 걸리며 정확한 기간은 앱의 복잡성과 기능에 따라 다릅니다. 기본 기능을 갖춘 간단한 앱은 개발하는 데 약 2~3개월이 걸릴 수 있습니다. 이러한 앱은 일반적으로 몇 개의 화면과 표준 기능 등 최소한의 기능만 갖추고 있습니다.

반면, 사용자 인증, 데이터베이스 통합, 실시간 업데이트 등의 기능이 포함된 보다 복잡한 앱의 경우 4~6개월 이상이 소요될 수 있습니다. 이러한 앱은 모든 것이 원활하게 실행되도록 하기 위해 더 자세한 계획, 설계 및 테스트가 필요합니다.

개발 시간에 영향을 미치는 또 다른 요소는 프로젝트에 참여하는 팀의 규모입니다. 규모가 크고 경험이 풍부한 팀은 소규모 그룹보다 앱을 더 빨리 완료할 수 있습니다. 커뮤니케이션 및 프로젝트 관리의 품질도 앱을 얼마나 빨리 완료할 수 있는지에 영향을 미칩니다.

앱 개발은 출시 후에도 끝나지 않는다는 점도 중요합니다. 버그를 수정하고 앱을 원활하게 실행하려면 정기적인 업데이트와 유지 관리가 필요합니다.

전체적으로 앱을 구축하는 데는 프로젝트 범위에 따라 몇 달에서 1년 이상이 걸릴 수 있습니다. 앱 요구 사항을 잘 계획하고 명확하게 이해하면 프로세스 속도를 높이는 데 도움이 될 수 있습니다.

iOS 앱 개발과 Android 앱 개발: 차이점은 무엇인가요?

모바일 앱을 만들 때 Apple 기기용 iOS 또는 기타 여러 휴대전화용 Android 중에서 선택할 수 있습니다. 둘 다 인기가 있지만 몇 가지 중요한 차이점이 있습니다. 비교해 봅시다:

Criteria

iOS App Development

Android App Development

Programming Language Swift and Objective-C Kotlin and Java
Development Environment Xcode Android Studio
Device Fragmentation Less device variety, easier to test Wide range of devices, harder to test
App Store Approval Strict review process Less strict, faster approval
Market Share Popular in North America and Europe Dominates in Asia, Africa, and more
Development Cost Usually higher due to stricter guidelines Can be lower, but depends on the complexity
Revenue Potential Higher app revenue per user Larger audience, but lower revenue per user

주요 차이점:

  • 프로그래밍 언어: iOS 앱은 Swift 또는 Objective-C로 구축되는 반면 Android 앱은 Kotlin 또는 Java를 사용합니다. Swift는 더 새롭고 배우기 쉬운 반면 Kotlin은 Android 기기 전반에 걸쳐 더 다양하게 사용할 수 있습니다.
  • 기기 단편화: iOS 개발자는 더 적은 수의 기기 모델을 다루므로 테스트가 더 간단해집니다. 그러나 Android 개발자는 다양한 기기와 화면 크기를 고려해야 합니다.
  • 수익 가능성: iOS 앱은 특히 인앱 구매에서 더 높은 수익을 창출하는 경우가 많습니다. Android 앱은 더 많은 잠재고객에게 도달하지만 사용자당 수익은 더 적을 수 있습니다.

전반적으로 두 플랫폼 모두 고유한 이점을 제공하며 타겟 고객과 목표에 따라 선택이 달라집니다.

Android 및 iOS용 화상 통화 앱을 만드는 방법

Android 및 iOS용 화상 통화 앱을 만드는 것은 까다로워 보일 수 있지만 올바른 도구를 사용하면 생각보다 쉽습니다. 이 섹션에서는 ZEGOCLOUD Express SDK를 사용하여 이를 수행하는 방법을 보여 드리겠습니다.

ZEGOCLOUD는 앱에 실시간 비디오 및 오디오 기능을 간단하게 추가할 수 있는 강력한 플랫폼입니다. 복잡한 부분을 처리하므로 사용자에게 원활한 경험을 제공하는 데 집중할 수 있습니다. ZEGOCLOUD를 사용하면 Android와 iOS 모두를 위한 화상 통화 앱을 빠르고 간단하게 구축할 수 있습니다.

전제조건

시작하기 전에 필요한 모든 것이 갖추어져 있는지 확인하세요.

  • ZEGOCLOUD 개발자 계정에 가입하세요.
  • ZEGOCLOUD 관리 대시보드에서 AppID와 AppSign을 받으세요.
  • 위의 Android Studio 2020.3.1이 설치되어 있거나 iOS 앱용 Xcode 13.0이 있어야 합니다.
  • 오디오 및 비디오를 지원하는 Android 4.4 또는 iOS 9.0 이상을 실행하는 기기를 사용하세요.
  • Android 또는 iOS 앱 개발에 대한 지식
  • 기기가 인터넷에 연결되어 있는지 확인하세요.

Android 화상 통화 앱

1. SDK 종속성 추가

1.1 Gradle 설정

Zego SDK를 사용하려면 Gradle을 통해 Android 프로젝트에 ZegoExpress SDK를 추가해야 합니다. 그렇게 하려면 아래 단계를 따르십시오.

  • Android Studio 버전 7.1.0 이상의 경우 프로젝트의 settings.gradle 파일을 엽니다. dependencyResolutionManagement 블록 내에 다음 코드를 추가합니다.
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        maven { url 'https://storage.zego.im/maven' }
        google()
        mavenCentral()
    }
}
  • 이전 버전의 Android Studio의 경우 프로젝트의 루트 디렉터리에서 build.gradle 파일을 엽니다. allprojects 블록 내에 다음 코드를 추가합니다.

    allprojects {
    repositories {
        maven { url 'https://storage.zego.im/maven' }
        google()
        mavenCentral()
    }
    }
    

1.2 SDK 종속성 추가

app/build.gradle 파일을 엽니다. 종속성 블록 내에 다음 줄을 추가합니다(x.y.z를 최신 SDK 버전으로 교체).

dependencies {
    implementation 'im.zego:express-video:x.y.z'
}

파일을 저장하고 프로젝트를 동기화하세요. ZegoExpress SDK가 추가되어 화상 통화 기능이 활성화됩니다.

2. SDK 가져오기

종속성이 동기화되면 Zego SDK를 기본 활동으로 가져와 영상 통화 기능 구현을 시작할 수 있습니다.

MainActivity.java 또는 MainActivity.kt 파일을 엽니다. 다음 가져오기 문을 추가합니다.

import im.zego.zegoexpress.ZegoExpressEngine;

이 가져오기를 통해 Zego SDK의 핵심 기능을 사용할 수 있습니다.

3. 영상통화 기능 구현

3.1 앱 자격 증명 정의

ZEGOCLOUD 대시보드에서 얻은 AppID와 AppSign을 정의해야 합니다.

기본 활동 파일에 다음 변수를 추가합니다.

String appID = "c12dbc38b67451a9ee8a0ba266840aab";  // Replace with your actual AppID
String appSign = "fe1529d55bcbcc0fa462cba668b8f2bd";  // Replace with your actual AppSign

3.2 사용자 및 회의실 정보 정의

이제 사용자와 영상통화방을 식별하기 위해 userID, userName, roomID를 정의합니다. 변수를 정의합니다:

String userID = "fc4a8a14869bc3b8f84d052a35378195";   // Replace with your actual user ID
String userName = "c157e43fc1e6147c21d7b2f420f7501f"; // Replace with your actual user name
String roomID = "93429f3717703a6e1b861e1d1565e862";   // Replace with your actual room ID

3.3 Zego 엔진 초기화

통화를 시작하기 전에 Zego 엔진을 초기화해야 합니다. 이 엔진은 모든 화상 통화 작업을 처리합니다. 엔진을 초기화하려면 다음 메서드를 추가하세요.

void createEngine() {
    ZegoEngineProfile profile = new ZegoEngineProfile();
    profile.appID = Long.parseLong(appID);
    profile.appSign = appSign;
    profile.application = getApplication();
    profile.scenario = ZegoScenario.DEFAULT; // Set the appropriate scenario
    ZegoExpressEngine.createEngine(profile, null);
}

이 메소드는 appID 및 appSign을 사용하여 ZegoExpressEngine을 초기화합니다. 시나리오는 일반적인 사용 사례에 적합한 DEFAULT로 설정됩니다.

3.4 영상 통화 시작 및 참여

이제 영상 통화를 시작하고 참여하는 방법을 구현해 보세요.

영상 통화 시작:

void startVideoCall() {
    ZegoExpressEngine.getEngine().startPublishingStream(roomID);
}

영상 통화 참여:

void joinVideoCall() {
    ZegoExpressEngine.getEngine().startPlayingStream(roomID);
}

4. 장치 권한 구성

영상 통화에서 카메라와 마이크에 액세스하려면 AndroidManifest.xml 파일에서 권한을 요청해야 합니다. AndroidManifest.xml 파일을 열고 다음 권한을 추가하세요.

eafa53ed60cf631bb40427ba7fd27cc3
cc4be989b182b85ab53d6e27e2649273
80768a34d765d25f66049afad58fea64

Android 6.0 이상의 경우 런타임 권한도 요청해야 합니다.

String[] permissions = {"android.permission.CAMERA", "android.permission.RECORD_AUDIO"};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    requestPermissions(permissions, 101);
}

5. Android 앱 실행 및 테스트

권한이 설정되면 이제 Android 앱을 실행하고 테스트할 수 있습니다.

  • Build and run your app on a real Android device.
  • Test the video call by starting the call on one device and joining the call on another using the same roomID.

iOS Video Call App

1. Adding the SDK Dependencies

1.1 Setting Up Swift Package Manager

For iOS, you will use Swift Package Manager to add the ZegoUIKitPrebuiltLiveStreaming SDK. Follow the steps below:

  • Open Xcode, and go to File > Add Packages.
  • In the search box, enter the following URL:
https://github.com/zegolibrary/express-video-ios

Select the latest version and add the package to your project.

2. Importing the SDK

Once the SDK is installed, you need to import it into your ViewController.swift file. In your ViewController.swift file, add the following import statements:

import ZegoUIKit
import ZegoUIKitPrebuiltLiveStreaming

These import statements give you access to the Zego video call SDK.

3. Implementing Video Call Functionality

3.1 Define App Credentials

You need your AppID and AppSign to authenticate your app with ZEGOCLOUD. Add the following credentials at the top of your ViewController.swift file:

let appID: UInt32 = 0122b644d0a0273642508c49a6bb2b8e  // Replace with your actual AppID
let appSign: String = "86c79318892e84f5d80aa6d0c14c7516"  // Replace with your actual AppSign

3.2 Define User and Room Information

Now, define the userID, userName, and roomID variables for identifying users and the room. Add these variables:

var userID: String = "fc4a8a14869bc3b8f84d052a35378195"   // Replace with actual user ID
var userName: String = "c157e43fc1e6147c21d7b2f420f7501f" // Replace with actual user name
var roomID: String = "93429f3717703a6e1b861e1d1565e862"   // Replace with actual room ID

3.3 Initializing the Zego Engine

Like Android, you must initialize the Zego engine on iOS to handle video call functionality. Add the function below:

func createEngine() {
    let profile = ZegoEngineProfile()
    profile.appID = appID
    profile.appSign = appSign
    ZegoExpressEngine.createEngine(with: profile, eventHandler: self)
}

This function initializes the Zego engine with your credentials.

3.4 Starting and Joining a Video Call

To start a video call as a host:

func startVideoCall() {
    ZegoExpressEngine.shared().startPublishingStream(roomID)
}

To join an existing video call:

func joinVideoCall() {
    ZegoExpressEngine.shared().startPlayingStream(roomID)
}

4. Configuring Device Permissions

In iOS, you need to request camera and microphone permissions in the Info.plist file. Open the Info.plist file and add the following keys:

42538adbdb6240b2b083a000a615d5bdNSCameraUsageDescription9780a7140ed8471d130dc57bcb9b0bd2
98c455a79ddfebb79781bff588e7b37eWe need access to your camera for video calls.dba3c644993c36696c11b074e67a4078
42538adbdb6240b2b083a000a615d5bdNSMicrophoneUsageDescription9780a7140ed8471d130dc57bcb9b0bd2
98c455a79ddfebb79781bff588e7b37eWe need access to your microphone for video calls.dba3c644993c36696c11b074e67a4078

These entries will display permission prompts when the user first opens the app.

5. Running and Testing Your Video Call App

Once your permissions are set, you can now test your app:

  • Open the .xcworkspace file in Xcode, select your target device, and run the app.
  • Start a video call on one device, then join it from another device using the same room ID to test the feature.

These are just the basics. To add more features to your video call app, explore ZEGOCLOUD’s Express Video SDK documentation. You can also get started with our sample source code!

Conclusion

Building a video call app with ZEGOCLOUD is a straightforward process, whether you're developing for Android or iOS. By following this guide, you can set up your project, integrate essential video calling features, and test the app on real devices. ZEGOCLOUD’s powerful SDK simplifies the implementation, allowing you to focus on user experience rather than complex backend processes.

Start building your custom video call app today and create seamless communication experiences for your users.

위 내용은 ZEGOCLOUD로 영상 통화 앱을 만드는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.