Fix sequential audio playback

This commit is contained in:
Ilya Laktyushin 2020-09-28 00:38:10 +04:00
parent 5f7f674e61
commit f9e2e7a0a1
3 changed files with 8 additions and 2 deletions

View File

@ -616,7 +616,7 @@ public final class ListMessageFileItemNode: ListMessageNode {
let (titleNodeLayout, titleNodeApply) = titleNodeMakeLayout(TextNodeLayoutArguments(attributedString: titleText, backgroundColor: nil, maximumNumberOfLines: 2, truncationType: .middle, constrainedSize: CGSize(width: params.width - leftInset - leftOffset - rightInset - dateNodeLayout.size.width - 4.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
let (textNodeLayout, textNodeApply) = textNodeMakeLayout(TextNodeLayoutArguments(attributedString: captionText, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
let (textNodeLayout, textNodeApply) = textNodeMakeLayout(TextNodeLayoutArguments(attributedString: captionText, backgroundColor: nil, maximumNumberOfLines: 3, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
let (descriptionNodeLayout, descriptionNodeApply) = descriptionNodeMakeLayout(TextNodeLayoutArguments(attributedString: descriptionText, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))

View File

@ -490,6 +490,8 @@ private final class MediaPlayerContext {
case .playing:
break
}
self.stoppedAtEnd = false
}
fileprivate func playOnceWithSound(playAndRecord: Bool, seek: MediaPlayerSeek = .start) {
@ -537,6 +539,8 @@ private final class MediaPlayerContext {
self.play()
}
}
self.stoppedAtEnd = false
}
fileprivate func continuePlayingWithoutSound() {
@ -892,7 +896,7 @@ private final class MediaPlayerContext {
let _ = self.playerStatusValue.swap(status)
}
if performActionAtEndNow {
if performActionAtEndNow && !self.stoppedAtEnd {
switch self.actionAtEnd {
case let .loop(f):
self.stoppedAtEnd = false

View File

@ -676,6 +676,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
case .random:
var playbackStack = self.playbackStack
inputIndex = messages
|> take(1)
|> map { messages, _, _ -> MessageIndex in
if case let .random(previous) = navigation, previous {
let _ = playbackStack.pop()
@ -695,6 +696,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
let historySignal = inputIndex
|> mapToSignal { inputIndex -> Signal<(Message, [Message])?, NoError> in
return messages
|> take(1)
|> mapToSignal { messages, _, loadMore -> Signal<(Message, [Message])?, NoError> in
let position: NavigatedMessageFromViewPosition
switch navigation {