Created
December 28, 2014 14:29
-
-
Save norio-nomura/a0c9f9af512c0b49b57d to your computer and use it in GitHub Desktop.
AVMutableComposition使う必要ないのでは?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift b/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift | |
index 9fdd89d..2d41bf4 100644 | |
--- a/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift | |
+++ b/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift | |
@@ -121,7 +121,7 @@ internal class AssetReaderFragment: NSObject { | |
// 注意点: | |
// - このビデオトラックにはコンポジション上のビデオトラックを指定すること | |
// - IOSurfaceで作成しなくても再生できるが、念のため付けておく | |
- let compoVideoTracks = composition.tracksWithMediaType(AVMediaTypeVideo) | |
+ let compoVideoTracks = asset.tracksWithMediaType(AVMediaTypeVideo) | |
var output = AVAssetReaderVideoCompositionOutput(videoTracks: compoVideoTracks, | |
videoSettings: [kCVPixelBufferPixelFormatTypeKey : kCVPixelFormatType_32BGRA, | |
kCVPixelBufferIOSurfacePropertiesKey : [:]]) | |
@@ -131,7 +131,7 @@ internal class AssetReaderFragment: NSObject { | |
output.alwaysCopiesSampleData = false | |
// コンポジションからアセットリーダーを作成し、アウトプットを接続 | |
- if let reader = AVAssetReader(asset: composition, error: &error) { | |
+ if let reader = AVAssetReader(asset: asset, error: &error) { | |
if reader.canAddOutput(output) { | |
reader.addOutput(output) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ありがとうございます。再生開始時間を指定したいので、AVMutableCompositionは必要なのです。なのですが、そうしないと再生開始までに時間がかかるのが気になりますね…