Skip to content

Commit edc865b

Browse files
author
xianing
committed
fix video metadata example
1 parent 4b0e275 commit edc865b

2 files changed

Lines changed: 27 additions & 17 deletions

File tree

iOS/APIExample/Examples/Advanced/VideoMetadata/Base.lproj/VideoMetadata.storyboard

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
89
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
910
</dependencies>
1011
<scenes>
@@ -24,15 +25,15 @@
2425
<fontDescription key="fontDescription" type="system" pointSize="14"/>
2526
<textInputTraits key="textInputTraits"/>
2627
</textField>
27-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kbN-ZR-nNn" userLabel="joinBtn">
28+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kbN-ZR-nNn" userLabel="joinBtn">
2829
<rect key="frame" x="172" y="74" width="30" height="30"/>
2930
<state key="normal" title="Join"/>
3031
<connections>
3132
<action selector="doJoinPressedWithSender:" destination="O0d-ef-mTa" eventType="touchUpInside" id="pdy-Tj-ycl"/>
3233
</connections>
3334
</button>
3435
</subviews>
35-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
36+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
3637
<constraints>
3738
<constraint firstItem="kbN-ZR-nNn" firstAttribute="centerX" secondItem="GWc-L5-fZV" secondAttribute="centerX" id="B5x-LS-GFH"/>
3839
<constraint firstItem="kbN-ZR-nNn" firstAttribute="top" secondItem="GWc-L5-fZV" secondAttribute="bottom" constant="20" id="LVQ-Cs-yOU"/>
@@ -43,13 +44,13 @@
4344
</constraints>
4445
</view>
4546
</subviews>
46-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
47+
<viewLayoutGuide key="safeArea" id="wDs-Gr-g1S"/>
48+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
4749
<constraints>
4850
<constraint firstItem="UzG-zY-iSA" firstAttribute="centerY" secondItem="wDs-Gr-g1S" secondAttribute="centerY" multiplier="0.8" id="8bT-wH-NDK"/>
4951
<constraint firstItem="UzG-zY-iSA" firstAttribute="leading" secondItem="wDs-Gr-g1S" secondAttribute="leading" constant="20" id="BQh-SU-OA6"/>
5052
<constraint firstItem="wDs-Gr-g1S" firstAttribute="trailing" secondItem="UzG-zY-iSA" secondAttribute="trailing" constant="20" id="gHu-5I-6Gb"/>
5153
</constraints>
52-
<viewLayoutGuide key="safeArea" id="wDs-Gr-g1S"/>
5354
</view>
5455
<connections>
5556
<outlet property="channelTextField" destination="GWc-L5-fZV" id="xDy-ai-JdS"/>
@@ -70,28 +71,28 @@
7071
<subviews>
7172
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="51Y-7q-1oS" customClass="AGEVideoContainer" customModule="AGEVideoLayout">
7273
<rect key="frame" x="0.0" y="44" width="414" height="233"/>
73-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
74+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
7475
<constraints>
7576
<constraint firstAttribute="width" secondItem="51Y-7q-1oS" secondAttribute="height" multiplier="16:9" id="La6-Ff-ASb"/>
7677
</constraints>
7778
</view>
78-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ucb-dZ-rMR">
79-
<rect key="frame" x="155" y="297" width="104" height="30"/>
79+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ucb-dZ-rMR">
80+
<rect key="frame" x="155" y="757" width="104" height="30"/>
8081
<state key="normal" title="Send metadata"/>
8182
<connections>
8283
<action selector="onSendMetadata" destination="teJ-cl-qvp" eventType="touchUpInside" id="zMz-w9-5Wc"/>
8384
</connections>
8485
</button>
8586
</subviews>
86-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
87+
<viewLayoutGuide key="safeArea" id="3w4-c2-Atk"/>
88+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
8789
<constraints>
8890
<constraint firstItem="3w4-c2-Atk" firstAttribute="trailing" secondItem="51Y-7q-1oS" secondAttribute="trailing" id="5Vf-Bp-028"/>
89-
<constraint firstItem="ucb-dZ-rMR" firstAttribute="top" secondItem="51Y-7q-1oS" secondAttribute="bottom" constant="20" id="Omx-jZ-LOL"/>
90-
<constraint firstItem="ucb-dZ-rMR" firstAttribute="centerX" secondItem="3w4-c2-Atk" secondAttribute="centerX" id="TBO-Y1-cYf"/>
91+
<constraint firstItem="ucb-dZ-rMR" firstAttribute="centerX" secondItem="51Y-7q-1oS" secondAttribute="centerX" id="7gS-5e-HAp"/>
9192
<constraint firstItem="51Y-7q-1oS" firstAttribute="leading" secondItem="3w4-c2-Atk" secondAttribute="leading" id="Zuw-LI-bpW"/>
9293
<constraint firstItem="51Y-7q-1oS" firstAttribute="top" secondItem="3w4-c2-Atk" secondAttribute="top" id="iSa-J7-QrI"/>
94+
<constraint firstItem="3w4-c2-Atk" firstAttribute="bottom" secondItem="ucb-dZ-rMR" secondAttribute="bottom" constant="75" id="rjR-iS-iYa"/>
9395
</constraints>
94-
<viewLayoutGuide key="safeArea" id="3w4-c2-Atk"/>
9596
</view>
9697
<connections>
9798
<outlet property="container" destination="51Y-7q-1oS" id="HqG-Ma-rxY"/>
@@ -103,4 +104,9 @@
103104
<point key="canvasLocation" x="-2113" y="1936"/>
104105
</scene>
105106
</scenes>
107+
<resources>
108+
<systemColor name="systemBackgroundColor">
109+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
110+
</systemColor>
111+
</resources>
106112
</document>

iOS/APIExample/Examples/Advanced/VideoMetadata/VideoMetadata.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ class VideoMetadataMain: BaseViewController {
106106
// 2. If app certificate is turned on at dashboard, token is needed
107107
// when joining channel. The channel name and uid used to calculate
108108
// the token has to match the ones used for channel join
109-
let result = agoraKit.joinChannel(byToken: nil, channelId: channelName, info: nil, uid: 0) {[unowned self] (channel, uid, elapsed) -> Void in
110-
self.isJoined = true
111-
LogUtils.log(message: "Join \(channel) with uid \(uid) elapsed \(elapsed)ms", level: .info)
112-
}
109+
let option = AgoraRtcChannelMediaOptions()
110+
option.clientRoleType = .of((Int32)(AgoraClientRole.broadcaster.rawValue))
111+
let result = agoraKit.joinChannel(byToken: KeyCenter.Token, channelId: channelName, uid: 0, mediaOptions: option)
113112
if(result != 0) {
114113
// Usually happens with invalid parameters
115114
// Error code description can be found at:
@@ -165,6 +164,11 @@ extension VideoMetadataMain: AgoraRtcEngineDelegate {
165164
self.showAlert(title: "Error", message: "Error \(errorCode.description) occur")
166165
}
167166

167+
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int) {
168+
self.isJoined = true
169+
LogUtils.log(message: "Join \(channel) with uid \(uid) elapsed \(elapsed)ms", level: .info)
170+
}
171+
168172
/// callback when a remote user is joinning the channel, note audience in live broadcast mode will NOT trigger this event
169173
/// @param uid uid of remote joined user
170174
/// @param elapsed time elapse since current sdk instance join the channel in ms

0 commit comments

Comments
 (0)