RxAudioVisual is a RxSwift wrapper around AVFoundation.
Target
Version
iOS
=> 10.0
Swift
~> 4.0
RxSwift / RxCocoa
~> 4.0
RxAudioVisual is available through CocoaPods .
AVAsynchronousKeyValueLoading
asset. rx. playable. subscribe (
onSuccess: { playable in
// Do something nice.
}
)
player. rx. status. filter { $0 == . readyToPlay } . subscribe ( onNext: { _ in
player. play ( )
} ) . addDisposableTo ( self . disposeBag)
playerLayer. rx. readyForDisplay. filter { $0 == true } . subscribe ( onNext: { [ weak self] _ in
playerLayer. frame = self ? . videoView. bounds
self ? . videoView. layer. addSublayer ( playerLayer)
} ) . addDisposableTo ( self . disposeBag)
item. rx. didPlayToEnd. subscribe ( onNext: { _ in
player. seek ( to: kCMTimeZero)
player. play ( )
} ) . addDisposableTo ( self . disposeBag)
property
ObservableType
Element
duration
Single
CMTime
preferredRate
Single
Float
preferredVolume
Single
Float
preferredTransform
Single
CGAffineTransform
tracks
Single
[AVAssetTrack]
playable
Single
Bool
exportable
Single
Bool
readable
Single
Bool
composable
Single
Bool
compatibleWithSavedPhotosAlbum
Single
Bool
compatibleWithAirPlayVideo
Single
Bool
property
ObservableType
Element
playable
Single
Bool
enabled
Single
Bool
selfContained
Single
Bool
totalSampleDataLength
Single
Int64
timeRange
Single
CMTimeRange
naturalTimeScale
Single
CMTimeScale
estimatedDataRate
Single
Float
naturalSize
Single
CGSize
preferredTransform
Single
CGAffineTransform
preferredVolume
Single
Float
nominalFrameRate
Single
Float
property
ObservableType
Element
status
Observable
AVPlayerStatus
error
Observable
NSError?
timeControlStatus
Observable
AVPlayerTimeControlStatus
rate
Observable
Float
currentItem
Observable
AVPlayerItem?
actionAtItemEnd
Observable
AVPlayerActionAtItemEnd
volume
Observable
Float
muted
Observable
Bool
closedCaptionDisplayEnabled
Observable
Bool
allowsExternalPlayback
Observable
Bool
externalPlaybackActive
Observable
Bool
usesExternalPlaybackWhileExternalScreenIsActive
Observable
Bool
property
ObservableType
Element
asset
Observable
AVAsset?
duration
Observable
CMTime
error
Observable
NSError?
loadedTimeRanges
Observable
[NSValue]
presentationSize
Observable
CMTime
status
Observable
AVPlayerItemStatus
timebase
Observable
CMTimebase?
tracks
Observable
[AVPlayerItemTrack]
seekableTimeRanges
Observable
[NSValue]
isPlaybackLikelyToKeepUp
Observable
Bool
isPlaybackBufferEmpty
Observable
Bool
isPlaybackBufferFull
Observable
Bool
didPlayToEnd
Observable
Notification
timeJumped
Observable
Notification
failedToPlayToEndTime
Observable
Notification
playbackStalled
Observable
Notification
newAccessLogEntry
Observable
Notification
newErrorLogEntry
Observable
Notification
property
ObservableType
Element
player
Observable
AVPlayer?
readyForDisplay
Observable
Bool
videoRect
Observable
CGRect
keita.oouchi, keita.oouchi@gmail.com
RxAudioVisual is available under the MIT license. See the LICENSE file for more info.