1234567891011121314151617181920212223242526272829303132 |
- //
- // BFVideoThumbProgressStrategy.swift
- // BFRecordScreenKit
- //
- // Created by 胡志强 on 2021/12/6.
- //
- import AVFoundation
- import Foundation
- protocol BFVideoThumbProgressStrategyProtocol {
- // 根据视频时长获取需要的缩略图数量
- func frameNumberOfVideo(assetDuration: Double) -> Int
- }
- class BFVideoThumbProgressStrategy: BFVideoThumbProgressStrategyProtocol {
- func frameNumberOfVideo(assetDuration: Double) -> Int {
- var count = -1
- if assetDuration > 0, assetDuration <= 10 {
- count = 5
- } else if assetDuration >= 10, assetDuration < 60 {
- count = 10
- } else if assetDuration >= 60, assetDuration < 300 {
- count = 20
- } else if assetDuration >= 300 {
- count = 30
- }
- return count
- }
- }
|