Latest 1.0.1
Homepage https://github.com/keitaoouchi/RxAudioVisual
License MIT
Platforms ios 8.0
Dependencies RxSwift, RxCocoa
Frameworks AVFoundation
Authors

Build Status
Swift 3.0
Carthage compatible
Version
License
Platform

RxAudioVisual is a RxSwift wrapper around AVFoundation.

Requirements

Target Version
iOS ~> 9.0
Swift ~> 3.0
RxSwift / RxCocoa ~> 3.4

Installation

RxAudioVisual is available through CocoaPods.

CocoaPods

pod "RxAudioVisual"

Getting started

AVAsynchronousKeyValueLoading

asset.rx.playable.subscribe(
  onSuccess: { playable in
    // Do something nice.
  }
)

KVO

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)

Notification

item.rx.didPlayToEnd.subscribe(onNext: { _ in
  player.seek(to: kCMTimeZero)
  player.play()
}).addDisposableTo(self.disposeBag)

Overview

AVAsset

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

AVAssetTrack

property ObservableType Element
mediaType Single String?
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

AVPlayer

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

AVPlayerItem

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

AVPlayerLayer

property ObservableType Element
player Observable AVPlayer?
videoGravity Observable String
readyForDisplay Observable Bool
videoRect Observable CGRect

Author

keita.oouchi, [email protected]

License

RxAudioVisual is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RxAudioVisual",
    "version": "1.0.1",
    "summary": "A reactive wrapper built around AVFoundation.",
    "homepage": "https://github.com/keitaoouchi/RxAudioVisual",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "keitaoouchi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/keitaoouchi/RxAudioVisual.git",
        "tag": "1.0.1"
    },
    "source_files": "RxAudioVisual/*.swift",
    "frameworks": "AVFoundation",
    "platforms": {
        "ios": "8.0"
    },
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "dependencies": {
        "RxSwift": [
            "~> 3.4"
        ],
        "RxCocoa": [
            "~> 3.4"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This