LiveStreamCore
module's LiveCoreView
to implement a custom co-hosting and connection view.LiveStreamCore
, you need to integrate and log in to LiveStreamCore to ensure the subsequent features work properly.LiveStreamCore
module, then create a LiveCoreView
view object and add it to your view.importLiveStreamCore
import
RTCRoomEngine
class CustomizeConncetionController: UIViewController {private let liveCoreView: LiveCoreView = {let view = LiveCoreView()return view}()override func viewDidLoad() {super.viewDidLoad()self.liveCoreView.videoViewDelegate = self// Add liveCoreView to the view and set layout constraints}}
public class CustomizeConnectionActivity extends AppCompatActivity {@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);LiveCoreView liveCoreView = new LiveCoreView(this);addContentView(liveCoreView,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));}}
LiveCoreView
delegate VideoViewDelegate
.protocol VideoViewDelegate {func createCoGuestView(userInfo: TUIUserInfo) -> UIView?func updateCoGuestView(userInfo: TUIUserInfo, modifyFlag: UserInfoModifyFlag, coGuestView: UIView)func createCoHostView(coHostUser: TUIConnectionUser) -> UIView?func updateCoHostView(coHostUser: TUIConnectionUser, modifyFlag: UserInfoModifyFlag, coHostView: UIView)}
extension CustomizeSeatViewController:SGSeatViewDelegate
{
func createCoGuestView(userInfo: TUIUserInfo) -> UIView? {
return CustomCoGuestView(userInfo: userInfo)}func updateCoGuestView(userInfo: TUIUserInfo, modifyFlag: UserInfoModifyFlag, coGuestView: UIView) {if let coGuestView = coGuestView as? CustomCoGuestView {coGuestView.updateView(withUserInfo: userInfo)}}func createCoHostView(coHostUser: TUIConnectionUser) -> UIView? {return CustomCoHostView(coHostUser: coHostUser)}func updateCoHostView(coHostUser: TUIConnectionUser, modifyFlag: UserInfoModifyFlag, coHostView: UIView)if let coHostiew = coHostiew as? CustomCoGuestView {coHostiew.updateView(withUser: coHostUser)}}}
// Please replace with your CoGuestViewclass CustomCoGuestView: UIView {var userInfo: TUIUserInfo = TUIUserInfo()// ... UIinit(userInfo: TUIUserInfo) {self.userInfo = userInfo}required init?(coder: NSCoder) {fatalError("init(coder:) has not been implemented")}func updateView(withUserInfo userInfo: TUIUserInfo) {self.userInfo = userInfo// ...}}// Please replace with your CoHostViewclass CustomCoHostView: UIView {var coHostUser: TUIConnectionUser = TUIConnectionUser()// ... UIinit(coHostUser: TUIConnectionUser) {self.coHostUser = coHostUser}required init?(coder: NSCoder) {fatalError("init(coder:) has not been implemented")}func updateView(withUser user: TUIConnectionUser) {self.coHostUser = user// ...}}
LiveCoreView
adapter VideoViewAdapter.public interface VideoViewAdapter {View createCoGuestView(TUIRoomDefine.UserInfo var1);void updateCoGuestView(TUIRoomDefine.UserInfo var1, List<UserInfoModifyFlag> var2, View var3);View createCoHostView(CoHostUser var1);void updateCoHostView(CoHostUser var1, List<UserInfoModifyFlag> var2, View var3);}
liveCoreView.setVideoViewAdapter(new LiveCoreViewDefine.VideoViewAdapter() {@Overridepublic View createCoGuestView(TUIRoomDefine.UserInfo userInfo) {TextView coGuestUserName = new TextView(CustomizeConnectionActivity.this);coGuestUserName.setText(userInfo.userName);return coGuestUserName;}@Overridepublic void updateCoGuestView(TUIRoomDefine.UserInfo userInfo, List<LiveCoreViewDefine.UserInfoModifyFlag> list, View view) {}@Overridepublic View createCoHostView(LiveCoreViewDefine.CoHostUser coHostUser) {TextView coHostUserName = new TextView(CustomizeConnectionActivity.this);coHostUserName.setText(coHostUser.connectionUser.userName);return coHostUserName;}@Overridepublic void updateCoHostView(LiveCoreViewDefine.CoHostUser coHostUser, List<LiveCoreViewDefine.UserInfoModifyFlag> list, View view) {}});
Was this page helpful?