mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 21:16:35 +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.hasVideo = true
|
||||||
strongSelf.updated(transition: .immediate)
|
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))
|
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)
|
state.updateDismissOffset(value: offset.y, interactive: true)
|
||||||
case let .ended(velocity):
|
case let .ended(velocity):
|
||||||
if abs(velocity.y) > 200.0 {
|
if abs(velocity.y) > 200.0 {
|
||||||
activatePictureInPicture.invoke(Action { [weak state] in
|
if state.isPictureInPictureSupported {
|
||||||
guard let state = state, let controller = controller() as? MediaStreamComponentController else {
|
activatePictureInPicture.invoke(Action { [weak state] in
|
||||||
return
|
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 {
|
} else {
|
||||||
state.updateDismissOffset(value: 0.0, interactive: false)
|
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 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 internalId: CallSessionInternalId
|
||||||
public let peerId: PeerId
|
public let peerId: PeerId
|
||||||
private let isChannel: Bool
|
private let isChannel: Bool
|
||||||
|
|||||||
@ -2532,6 +2532,8 @@ func _internal_getVideoBroadcastPart(dataSource: AudioBroadcastDataSource, callI
|
|||||||
scale = 0
|
scale = 0
|
||||||
case 500:
|
case 500:
|
||||||
scale = 1
|
scale = 1
|
||||||
|
case 32000:
|
||||||
|
scale = -5
|
||||||
default:
|
default:
|
||||||
return .single(GetAudioBroadcastPartResult(status: .notReady, responseTimestamp: Double(timestampIdMilliseconds) / 1000.0))
|
return .single(GetAudioBroadcastPartResult(status: .notReady, responseTimestamp: Double(timestampIdMilliseconds) / 1000.0))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -443,7 +443,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId]
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createSignal = context.engine.peers.createGroup(title: title, peerIds: peerIds)
|
createSignal = context.engine.peers.createGroup(title: title, peerIds: peerIds, ttlPeriod: nil)
|
||||||
}
|
}
|
||||||
case .supergroup:
|
case .supergroup:
|
||||||
createSignal = context.engine.peers.createSupergroup(title: title, description: nil)
|
createSignal = context.engine.peers.createSupergroup(title: title, description: nil)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user