제품 업데이트
Tencent Cloud 오디오/비디오 단말 SDK 재생 업그레이드 및 권한 부여 인증 추가
TRTC 월간 구독 패키지 출시 관련 안내

Source, Resources 및 TXAppBasic 폴더와 TUIKaraoke.podspec 파일을 프로젝트에 복사하여 다음 가져오기 작업을 완료합니다.Podfile에 다음 가져오기 명령을 추가합니다.pod 'TUIKaraoke', :path => "./", :subspecs => ["TRTC"]pod ’TXLiteAVSDK_TRTC’pod 'TXAppBasic', :path => "TXAppBasic/"
Podfile 디렉터리에서 다음 설치 명령을 실행합니다.pod install
<key>NSMicrophoneUsageDescription</key><string>Karaoke는 마이크에 액세스 필요</string>
// 1. 초기화let karaokeRoom = TRTCKaraokeRoom.shared()karaokeRoom.setDelegate(delegate: self)// 2. 로그인karaokeRoom.login(SDKAppID: Int32(SDKAppID), UserId: UserId, UserSig: ProfileManager.shared.curUserSig()) { code, message inif code == 0 {//로그인 성공}}

int roomId = "방 ID";let param = RoomParam.init()param.roomName = "방 이름";param.needRequest = false; // 마이크 연결 시 방 주인 확인 필요 여부param.seatCount = 8; // 방의 좌석 수. 8개로 설정param.coverUrl = "방 커버 이미지의 URL";karaokeRoom.createRoom(roomID: Int32(roomInfo.roomID), roomParam: param) { [weak self] (code, message) inguard let `self` = self else { return }if code == 0 {//방 생성 성공}}
karaokeRoom.enterRoom(roomID: roomInfo.roomID) { [weak self] (code, message) inguard let `self` = self else { return }if code == 0 {//방 들어가기 성공}}
// 1. 청취자가 마이크를 켜기 위해 API 호출int seatIndex = 1;karaokeRoom.enterSeat(seatIndex: seatIndex) { [weak self] (code, message) inguard let `self` = self else { return }if code == 0 {//마이크 활성화 성공}}// 2. 청취자는 onSeatListChange 콜백을 수신하고 좌석 목록을 새로고침함func onSeatListChange(seatInfoList: [SeatInfo]) {}
//음악 재생karaokeRoom.startPlayMusic(musicID: musicID, originalUrl: muscicLocalPath, accompanyUrl: accompanyLocalPath);//음악 중지karaokeRoom.stopPlayMusic();
// 발신측: 텍스트 메시지 발송karaokeRoom.sendRoomTextMsg(message: message) { [weak self] (code, message) inif code == 0 {//전송 성공}}// 수신측: 텍스트 메시지 수신karaokeRoom.setDelegate(delegate: self)func onRecvRoomTextMsg(message: String, userInfo: UserInfo) {debugPrint(userInfo.userName + "님이 발송한 메시지:" + message)}
// 발신측: "IMCMD_GIFT"를 사용자 지정하여 선물 메시지를 구분합니다.karaokeRoom.sendRoomCustomMsg(cmd: kSendGiftCmd, message: message) { code, msg inif (code == 0) {//전송 성공}}// 수신측: 선물 메시지 수신karaokeRoom.setDelegate(delegate: self)func onRecvRoomCustomMsg(cmd: String, message: String, userInfo: UserInfo) {if cmd == kSendGiftCmd {debugPrint(userInfo.userName + "님이 보낸" + "선물을 받았습니다." + message)}}
피드백