From 647df59f07bc7f67ff4721570f6ad67f0554d6d3 Mon Sep 17 00:00:00 2001 From: gzerad Date: Wed, 14 Dec 2022 13:21:00 +0200 Subject: [PATCH] 0.5.3 Release --- .../HMSSDKExample.xcodeproj/project.pbxproj | 8 +- .../Meeting/HLS/HLSStreamViewController.swift | 2 +- .../Meeting/HLSStreamViewController.swift | 219 ------------------ .../Meeting/HMSSDKInteractor.swift | 1 + .../SupportingFiles/Utilities.swift | 4 + HMSSDK.podspec | 8 +- Package.swift | 8 +- 7 files changed, 18 insertions(+), 232 deletions(-) delete mode 100644 Example/HMSSDKExample/Meeting/HLSStreamViewController.swift diff --git a/Example/HMSSDKExample.xcodeproj/project.pbxproj b/Example/HMSSDKExample.xcodeproj/project.pbxproj index 8f46c34..ceae42e 100644 --- a/Example/HMSSDKExample.xcodeproj/project.pbxproj +++ b/Example/HMSSDKExample.xcodeproj/project.pbxproj @@ -23,7 +23,6 @@ 877455D72872C32F007B11FB /* MusicControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 877455D62872C32F007B11FB /* MusicControlView.swift */; }; 877455D92872D4C9007B11FB /* VolumeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 877455D82872D4C9007B11FB /* VolumeView.swift */; }; 879165FF280B036A006FB04A /* GrayscaleVideoPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 879165FE280B036A006FB04A /* GrayscaleVideoPlugin.swift */; }; - 9109731D276221EA00B76729 /* HLSStreamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9109731C276221EA00B76729 /* HLSStreamViewController.swift */; }; 9109732727636DF800B76729 /* HLSSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9109732627636DF800B76729 /* HLSSettingsViewController.swift */; }; 9120573E2747C35C00E6CC8E /* PeerMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9120573D2747C35C00E6CC8E /* PeerMetadata.swift */; }; 9172A7B227E8949C0054AEFA /* NetworkQualityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9172A7B127E8949C0054AEFA /* NetworkQualityView.swift */; }; @@ -33,6 +32,7 @@ 91A44EBA292F7D910032AE75 /* ImagePreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A44EB9292F7D910032AE75 /* ImagePreviewView.swift */; }; 91AD889726F9E66B00EE3035 /* RolePreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91AD889626F9E66B00EE3035 /* RolePreviewViewController.swift */; }; 91AD889926F9E6F400EE3035 /* PreJoinPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91AD889826F9E6F400EE3035 /* PreJoinPreviewViewController.swift */; }; + 91B791F92949EAA800534E00 /* HLSStreamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91B791F82949EAA800534E00 /* HLSStreamViewController.swift */; }; 91C13CDB26F23F5A00036555 /* RTMPSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91C13CDA26F23F5A00036555 /* RTMPSettingsViewController.swift */; }; 91D4894927B6527300F79445 /* PreviewPeersListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91D4894827B6527200F79445 /* PreviewPeersListViewController.swift */; }; 91E7E145268C70F2001D988E /* PreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91E7E144268C70F2001D988E /* PreviewViewController.swift */; }; @@ -129,7 +129,6 @@ 877455D62872C32F007B11FB /* MusicControlView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MusicControlView.swift; sourceTree = ""; }; 877455D82872D4C9007B11FB /* VolumeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VolumeView.swift; sourceTree = ""; }; 879165FE280B036A006FB04A /* GrayscaleVideoPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrayscaleVideoPlugin.swift; sourceTree = ""; }; - 9109731C276221EA00B76729 /* HLSStreamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HLSStreamViewController.swift; sourceTree = ""; }; 9109732627636DF800B76729 /* HLSSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HLSSettingsViewController.swift; sourceTree = ""; }; 9120573D2747C35C00E6CC8E /* PeerMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeerMetadata.swift; sourceTree = ""; }; 9172A7B127E8949C0054AEFA /* NetworkQualityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkQualityView.swift; sourceTree = ""; }; @@ -139,6 +138,7 @@ 91A44EB9292F7D910032AE75 /* ImagePreviewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImagePreviewView.swift; sourceTree = ""; }; 91AD889626F9E66B00EE3035 /* RolePreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RolePreviewViewController.swift; sourceTree = ""; }; 91AD889826F9E6F400EE3035 /* PreJoinPreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreJoinPreviewViewController.swift; sourceTree = ""; }; + 91B791F82949EAA800534E00 /* HLSStreamViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HLSStreamViewController.swift; path = HLS/HLSStreamViewController.swift; sourceTree = ""; }; 91C13CDA26F23F5A00036555 /* RTMPSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RTMPSettingsViewController.swift; sourceTree = ""; }; 91D4894827B6527200F79445 /* PreviewPeersListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewPeersListViewController.swift; sourceTree = ""; }; 91D82365281FD1E1000145E8 /* HMSScreenShareRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HMSScreenShareRelease.entitlements; sourceTree = ""; }; @@ -373,10 +373,10 @@ 91A44EB4292F7D400032AE75 /* Stats */, 917D6EEA26EF464D00B5C7DE /* Menus */, EC8CEE5D261E297F002DC12E /* MeetingViewController.swift */, + 91B791F82949EAA800534E00 /* HLSStreamViewController.swift */, 87FF5A9A288000F400B731FD /* Music Controls */, 91AD889626F9E66B00EE3035 /* RolePreviewViewController.swift */, EC8CEE61261E297F002DC12E /* MeetingViewModel.swift */, - 9109731C276221EA00B76729 /* HLSStreamViewController.swift */, EC8CEE4D261E297F002DC12E /* HMSSDKInteractor.swift */, 879165FE280B036A006FB04A /* GrayscaleVideoPlugin.swift */, EC8CEE5F261E297F002DC12E /* RoomService.swift */, @@ -717,6 +717,7 @@ files = ( EC8CEE85261E297F002DC12E /* VideoCollectionViewCell.swift in Sources */, 91AD889726F9E66B00EE3035 /* RolePreviewViewController.swift in Sources */, + 91B791F92949EAA800534E00 /* HLSStreamViewController.swift in Sources */, ECF3ECE826BB0E7B00CC86C6 /* Constants.swift in Sources */, 91F9FB4027D0EA7800B407A0 /* RoomStateViewController.swift in Sources */, EC8CEE88261E297F002DC12E /* FirebaseInteractor.swift in Sources */, @@ -730,7 +731,6 @@ EC8CEE86261E297F002DC12E /* MeetingViewModel.swift in Sources */, 91AD889926F9E6F400EE3035 /* PreJoinPreviewViewController.swift in Sources */, EC8CEE78261E297F002DC12E /* HMSSDKInteractor.swift in Sources */, - 9109731D276221EA00B76729 /* HLSStreamViewController.swift in Sources */, 91A44EB8292F7D400032AE75 /* HLSStatsView.swift in Sources */, 877455D72872C32F007B11FB /* MusicControlView.swift in Sources */, 877455D92872D4C9007B11FB /* VolumeView.swift in Sources */, diff --git a/Example/HMSSDKExample/Meeting/HLS/HLSStreamViewController.swift b/Example/HMSSDKExample/Meeting/HLS/HLSStreamViewController.swift index a3bb498..a353064 100644 --- a/Example/HMSSDKExample/Meeting/HLS/HLSStreamViewController.swift +++ b/Example/HMSSDKExample/Meeting/HLS/HLSStreamViewController.swift @@ -81,7 +81,7 @@ class HLSStreamViewController: UIViewController, AVPlayerItemMetadataCollectorPu let session = AVAudioSession.sharedInstance() do { - try session.setCategory(.playAndRecord, options: [.defaultToSpeaker]) + try session.setCategory(.playAndRecord, options: [.defaultToSpeaker, .allowBluetooth]) try session.setActive(true) //Set to false to deactivate session } catch let error as NSError { print("Unable to activate audio session: \(error.localizedDescription)") diff --git a/Example/HMSSDKExample/Meeting/HLSStreamViewController.swift b/Example/HMSSDKExample/Meeting/HLSStreamViewController.swift deleted file mode 100644 index 96a46ed..0000000 --- a/Example/HMSSDKExample/Meeting/HLSStreamViewController.swift +++ /dev/null @@ -1,219 +0,0 @@ -// -// HLSStreamViewController.swift -// HMSSDKExample -// -// Created by Dmitry Fedoseyev on 09.12.2021. -// Copyright © 2021 100ms. All rights reserved. -// - -import UIKit -import AVFoundation - -class HLSStreamViewController: UIViewController, AVPlayerItemMetadataCollectorPushDelegate { - - var player: AVPlayer? - var playerView: PlayerView! - var metadataView: UILabel! - var metadataCollector: AVPlayerItemMetadataCollector! - var retriesLeft = 0 - var playerItem: AVPlayerItem? - var currentMetadataGroup: AVDateRangeMetadataGroup? - var metadataGroups = [AVDateRangeMetadataGroup]() - - var streamURL: URL? { - didSet { - if oldValue == streamURL { - return - } - stop() - retriesLeft = 10 - } - } - - override func loadView() { - let containerView = UIView() - view = containerView - - playerView = PlayerView() - containerView.addConstrained(subview: playerView) - - metadataView = UILabel() - containerView.addSubview(metadataView) - metadataView.translatesAutoresizingMaskIntoConstraints = false - metadataView.backgroundColor = .lightGray - metadataView.textColor = .black - metadataView.textAlignment = .center - metadataView.bottomAnchor.constraint(equalTo: playerView.bottomAnchor).isActive = true - metadataView.leftAnchor.constraint(equalTo: playerView.leftAnchor).isActive = true - metadataView.rightAnchor.constraint(equalTo: playerView.rightAnchor).isActive = true - metadataView.heightAnchor.constraint(equalToConstant: 60.0).isActive = true - metadataView.isHidden = true - } - - override func viewDidLoad() { - super.viewDidLoad() - NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground(_:)), name: UIApplication.didEnterBackgroundNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: UIApplication.didBecomeActiveNotification, object: nil) - } - - func play() { - guard let streamURL = streamURL else { - return - } - - let session = AVAudioSession.sharedInstance() - do { - try session.setCategory(.playAndRecord, options: [.defaultToSpeaker]) - try session.setActive(true) //Set to false to deactivate session - } catch let error as NSError { - print("Unable to activate audio session: \(error.localizedDescription)") - } - - // Create asset to be played - print("Trying to play: \(streamURL.absoluteString)") - let asset = AVAsset(url: streamURL) - - let assetKeys = [ - "playable" - ] - - metadataCollector = AVPlayerItemMetadataCollector() - metadataCollector.setDelegate(self, queue: DispatchQueue.main) - - // Create a new AVPlayerItem with the asset and an - // array of asset keys to be automatically loaded - let item = AVPlayerItem(asset: asset, - automaticallyLoadedAssetKeys: assetKeys) - item.add(metadataCollector) - - // Register as an observer of the player item's status property - item.addObserver(self, - forKeyPath: #keyPath(AVPlayerItem.status), - options: [.old, .new], - context: nil) - playerItem = item - - if player == nil { - player = AVPlayer(playerItem: item) - playerView.player = player - player?.addPeriodicTimeObserver(forInterval: CMTime(seconds: 1.0, preferredTimescale: CMTimeScale(NSEC_PER_SEC)), queue: .main, using: { [weak self] time in - self?.updateMetadataView(for: time) - }) - } else { - player?.replaceCurrentItem(with: item) - } - } - - func stop() { - player?.pause() - } - - func updateMetadataView(for currentTime: CMTime) { - hideCurrentMetadataViewIfNeeded() - - guard currentMetadataGroup == nil, let playerItem = playerItem else { return } - - for group in metadataGroups { - if group.shouldShow(for: playerItem) { - showMetadataView(for: group) - break - } - } - } - - func showMetadataView(for group: AVDateRangeMetadataGroup) { - guard currentMetadataGroup != group else { return } - - currentMetadataGroup = group - metadataView.isHidden = false - metadataView.text = group.items.first?.stringValue - } - - func hideCurrentMetadataViewIfNeeded() { - guard let currentMetadataGroup = currentMetadataGroup, - let playerItem = playerItem, - !currentMetadataGroup.shouldShow(for: playerItem) else { return } - self.currentMetadataGroup = nil - metadataView.isHidden = true - } - - override func observeValue(forKeyPath keyPath: String?, - of object: Any?, - change: [NSKeyValueChangeKey: Any]?, - context: UnsafeMutableRawPointer?) { - if keyPath == #keyPath(AVPlayerItem.status) { - let status: AVPlayerItem.Status - - // Get the status change from the change dictionary - if let statusNumber = change?[.newKey] as? NSNumber { - status = AVPlayerItem.Status(rawValue: statusNumber.intValue)! - } else { - status = .unknown - } - - // Switch over the status - switch status { - case .readyToPlay: - player?.play() - // Player item is ready to play. - case .failed: - if let error = playerItem?.error { - print("Playback error \(error)") - } - DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(10)) { [weak self] in - guard let self = self else { - return - } - - if self.retriesLeft > 0 { - self.retriesLeft = self.retriesLeft - 1 - self.play() - } - } - case .unknown: - print("Unknown player item status") - break - @unknown default: - print("Unknown player item status") - break - } - } - } - - @objc func applicationDidEnterBackground(_ notification: Notification) { - playerView.player = nil - } - - @objc func applicationDidBecomeActive(_ notificiation: Notification) { - playerView.player = player - } - - func metadataCollector(_ metadataCollector: AVPlayerItemMetadataCollector, - didCollect metadataGroups: [AVDateRangeMetadataGroup], - indexesOfNewGroups: IndexSet, - indexesOfModifiedGroups: IndexSet) { - self.metadataGroups = metadataGroups - } -} - -class PlayerView: UIView { - override class var layerClass: AnyClass { - return AVPlayerLayer.self - } - - var player: AVPlayer? { - get { - (layer as? AVPlayerLayer)?.player - } - set { - (layer as? AVPlayerLayer)?.player = newValue - } - } -} - -extension AVDateRangeMetadataGroup { - func shouldShow(for item: AVPlayerItem) -> Bool { - guard let endDate = endDate, let currentDate = item.currentDate() else { return false } - return startDate <= currentDate && currentDate < endDate - } -} diff --git a/Example/HMSSDKExample/Meeting/HMSSDKInteractor.swift b/Example/HMSSDKExample/Meeting/HMSSDKInteractor.swift index 893c872..1994546 100644 --- a/Example/HMSSDKExample/Meeting/HMSSDKInteractor.swift +++ b/Example/HMSSDKExample/Meeting/HMSSDKInteractor.swift @@ -71,6 +71,7 @@ final class HMSSDKInteractor: HMSUpdateListener { videoSettingsBuilder.initialMuteState = UserDefaults.standard.publishVideo ? .unmute : .mute videoSettingsBuilder.videoPlugins = self.videoPlugins videoSettingsBuilder.cameraFocusMode = .focusModeTapToAutoFocus + videoSettingsBuilder.cameraFacing = UserDefaults.standard.useBackCamera ? .back : .front audioSettingsBuilder.initialMuteState = UserDefaults.standard.publishAudio ? .unmute : .mute audioSettingsBuilder.audioSource = self.audioSource(for: sdk) diff --git a/Example/HMSSDKExample/SupportingFiles/Utilities.swift b/Example/HMSSDKExample/SupportingFiles/Utilities.swift index bbe1533..f114ebb 100644 --- a/Example/HMSSDKExample/SupportingFiles/Utilities.swift +++ b/Example/HMSSDKExample/SupportingFiles/Utilities.swift @@ -187,4 +187,8 @@ extension UserDefaults { set(newValue, forKey: Constants.publishVideo) } } + + var useBackCamera: Bool { + string(forKey: Constants.defaultVideoSource) == "Rear Facing" + } } diff --git a/HMSSDK.podspec b/HMSSDK.podspec index 8b94013..083a181 100644 --- a/HMSSDK.podspec +++ b/HMSSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'HMSSDK' - s.version = '0.5.2' + s.version = '0.5.3' s.summary = 'HMS Videoconferencing iOS SDK' s.description = <<-DESC @@ -10,12 +10,12 @@ TODO: Add long description of the pod here. s.homepage = 'https://github.com/100mslive/100ms-ios-sdk/' s.license = { :type => 'MIT'} s.author = { 'Dmitry Fedoseyev' => 'dmitry@100ms.live', 'Yogesh Singh' => 'yogesh@100ms.live', 'Pawan Dixit' => 'pawan@100ms.live'} - s.source = { :http => 'https://github.com/100mslive/100ms-ios-sdk/releases/download/0.5.2/HMSSDK.xcframework.zip', - :sha256 => '95e5d0d004abe56394d272bc788b580b0bf0d035f2ff4b192a14ffea4ebacc74' + s.source = { :http => 'https://github.com/100mslive/100ms-ios-sdk/releases/download/0.5.3/HMSSDK.xcframework.zip', + :sha256 => 'e843d552ce427e6c653a6890e60b0a5a2de53f5ba60fd81e9d89b0dc1b959bf2' } s.ios.deployment_target = '12.0' s.vendored_frameworks = 'HMSSDK.xcframework' - s.dependency 'HMSWebRTC', '1.0.4898' + s.dependency 'HMSWebRTC', '1.0.5113' end diff --git a/Package.swift b/Package.swift index 2bb12c2..eaa3a31 100644 --- a/Package.swift +++ b/Package.swift @@ -14,13 +14,13 @@ let package = Package( targets: [ .binaryTarget( name: "HMSSDK", - url: "https://github.com/100mslive/100ms-ios-sdk/releases/download/0.5.2/HMSSDK.xcframework.zip", - checksum: "95e5d0d004abe56394d272bc788b580b0bf0d035f2ff4b192a14ffea4ebacc74" + url: "https://github.com/100mslive/100ms-ios-sdk/releases/download/0.5.3/HMSSDK.xcframework.zip", + checksum: "e843d552ce427e6c653a6890e60b0a5a2de53f5ba60fd81e9d89b0dc1b959bf2" ), .binaryTarget( name: "WebRTC", - url: "https://github.com/100mslive/webrtc-ios/releases/download/1.0.4898/WebRTC.xcframework.zip", - checksum: "cf744aa15fa77b9b02151d1ed34c739f5bd72574664373da484d42c338f94d2e" + url: "https://github.com/100mslive/webrtc-ios/releases/download/1.0.5113/WebRTC.xcframework.zip", + checksum: "ab9c595207d29de457c22b2ec3fa7e632ef57daf9fbc90ed93eaf99a64b1893f" ) ] )