Comments (4)
我在buildPlayerItem中断点调试,发现
CompositionGenerator.swift 85行
timeline.videoChannel.enumerated().forEach({ (offset, provider) in
for index in 0..<provider.numberOfVideoTracks() {
let trackID: Int32 = getVideoTrackID(for: index) + Int32((offset % 2 + 1) * 1000)
if let compositionTrack = provider.videoCompositionTrack(for: composition, at: index, preferredTrackID: trackID) {
let info = mainVideoTrackInfo.first(where: { $0.track == compositionTrack })
if let info = info {
info.info.append(provider)
} else {
let info = TrackInfo.init(track: compositionTrack, info: [provider])
mainVideoTrackInfo.append(info)
}
}
}
这段代码中,provider.numberOfVideoTracks(),的值始终为0.PHAssetImageResource生成的TrackItem。
from cabbage.
我解决了这个问题。在下面的方法里,添加了对Bundle的定义:
private static let emptyAsset: AVAsset? = {
let bundle = Bundle(for: ImageResource.self)
/// 这里添加的3行代码解决了上述问题
if let videoURL = bundle.url(forResource: "black_empty", withExtension: "mp4") {
return AVAsset(url: videoURL)
}
if let bundleURL = bundle.resourceURL?.appendingPathComponent("Cabbage.bundle") {
let resourceBundle = Bundle.init(url: bundleURL)
if let videoURL = resourceBundle?.url(forResource: "black_empty", withExtension: "mp4") {
return AVAsset(url: videoURL)
}
}
if let url = Bundle.main.url(forResource: "black_empty", withExtension: "mp4") {
let asset = AVAsset(url: url)
return asset
}
return nil
}()
from cabbage.
这个修改欢迎提交 pr
from cabbage.
好的,我会在最近提交PR
from cabbage.
Related Issues (20)
- TrackItem with ImageResource does not work in Timeline overlays HOT 2
- player background blur effect HOT 2
- 添加片段过多内存暴增
- Player add blur background HOT 6
- Use Kingfisher to report an error
- About the text overlay, edit, drag and drop, zoom. HOT 1
- CIImage Memory leak HOT 2
- Overlay H.265 Video with Transparency HOT 4
- option to change number of frames on export
- Sound gone when scaled video HOT 1
- Multiple timelines HOT 1
- black screen when the audio overlay goes to finish HOT 2
- transition demo not work HOT 1
- 如何知道轨道和片段之间的关系
- Is this framework support multiple layer blend mode? HOT 1
- Capture the current frame in composed player item HOT 1
- avplayer seek后,影音不同步 HOT 1
- Exported video appears to be darker (colour shifting) HOT 3
- Orientation problem: some videos are rotated by 90 or 180 degrees
- Example of merging several videos in sequence
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cabbage.