mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 05:03:45 +00:00
Api Experiments
This commit is contained in:
parent
aa2fbaf293
commit
9e9b7b58d5
@ -596,6 +596,53 @@ public final class MediaStreamComponent: CombinedComponent {
|
||||
}
|
||||
strongSelf.hasVideo = true
|
||||
strongSelf.updated(transition: .immediate)
|
||||
|
||||
/*let engine = strongSelf.call.accountContext.engine
|
||||
guard let info = strongSelf.call.initialCall else {
|
||||
return
|
||||
}
|
||||
let _ = (engine.calls.getAudioBroadcastDataSource(callId: info.id, accessHash: info.accessHash)
|
||||
|> mapToSignal { source -> Signal<Data?, NoError> in
|
||||
guard let source else {
|
||||
return .single(nil)
|
||||
}
|
||||
|
||||
let time = engine.calls.requestStreamState(dataSource: source, callId: info.id, accessHash: info.accessHash)
|
||||
|> map { state -> Int64? in
|
||||
guard let state else {
|
||||
return nil
|
||||
}
|
||||
return state.channels.first?.latestTimestamp
|
||||
}
|
||||
|
||||
return time
|
||||
|> mapToSignal { latestTimestamp -> Signal<Data?, NoError> in
|
||||
guard let latestTimestamp else {
|
||||
return .single(nil)
|
||||
}
|
||||
|
||||
let durationMilliseconds: Int64 = 32000
|
||||
let bufferOffset: Int64 = 1 * durationMilliseconds
|
||||
let timestampId = latestTimestamp - bufferOffset
|
||||
|
||||
return engine.calls.getVideoBroadcastPart(dataSource: source, callId: info.id, accessHash: info.accessHash, timestampIdMilliseconds: timestampId, durationMilliseconds: durationMilliseconds, channelId: 2, quality: 0)
|
||||
|> mapToSignal { result -> Signal<Data?, NoError> in
|
||||
switch result.status {
|
||||
case let .data(data):
|
||||
return .single(data)
|
||||
case .notReady, .resyncNeeded, .rejoinNeeded:
|
||||
return .single(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { [weak self] data in
|
||||
guard let self, let data else {
|
||||
return
|
||||
}
|
||||
let _ = self
|
||||
let _ = data
|
||||
})*/
|
||||
})
|
||||
|
||||
let callPeer = call.accountContext.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: call.peerId))
|
||||
@ -1116,13 +1163,19 @@ public final class MediaStreamComponent: CombinedComponent {
|
||||
state.updateDismissOffset(value: offset.y, interactive: true)
|
||||
case let .ended(velocity):
|
||||
if abs(velocity.y) > 200.0 {
|
||||
activatePictureInPicture.invoke(Action { [weak state] in
|
||||
guard let state = state, let controller = controller() as? MediaStreamComponentController else {
|
||||
return
|
||||
if state.isPictureInPictureSupported {
|
||||
activatePictureInPicture.invoke(Action { [weak state] in
|
||||
guard let state = state, let controller = controller() as? MediaStreamComponentController else {
|
||||
return
|
||||
}
|
||||
state.updateDismissOffset(value: velocity.y < 0 ? -height : height, interactive: false)
|
||||
controller.dismiss(closing: false, manual: true)
|
||||
})
|
||||
} else {
|
||||
if let controller = controller() as? MediaStreamComponentController {
|
||||
controller.dismiss(closing: false, manual: true)
|
||||
}
|
||||
state.updateDismissOffset(value: velocity.y < 0 ? -height : height, interactive: false)
|
||||
controller.dismiss(closing: false, manual: true)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
state.updateDismissOffset(value: 0.0, interactive: false)
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
|
||||
private let getDeviceAccessData: () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void)
|
||||
|
||||
private var initialCall: EngineGroupCallDescription?
|
||||
private(set) var initialCall: EngineGroupCallDescription?
|
||||
public let internalId: CallSessionInternalId
|
||||
public let peerId: PeerId
|
||||
private let isChannel: Bool
|
||||
|
||||
@ -2532,6 +2532,8 @@ func _internal_getVideoBroadcastPart(dataSource: AudioBroadcastDataSource, callI
|
||||
scale = 0
|
||||
case 500:
|
||||
scale = 1
|
||||
case 32000:
|
||||
scale = -5
|
||||
default:
|
||||
return .single(GetAudioBroadcastPartResult(status: .notReady, responseTimestamp: Double(timestampIdMilliseconds) / 1000.0))
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
createSignal = context.engine.peers.createGroup(title: title, peerIds: peerIds)
|
||||
createSignal = context.engine.peers.createGroup(title: title, peerIds: peerIds, ttlPeriod: nil)
|
||||
}
|
||||
case .supergroup:
|
||||
createSignal = context.engine.peers.createSupergroup(title: title, description: nil)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user