Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got some errors when I import VideoTImelineView to my project #9

Open
vargrgrgr opened this issue Jul 26, 2022 · 1 comment
Open

Comments

@vargrgrgr
Copy link

in swift 4(or 5)

int(double) make runtime errors

I quick fixed below func to avoid runtime error

in TimelineView.swift
func snapWidth(_ width:CGFloat, max:CGFloat) -> CGFloat {
let n = log2((2 * max) / width)
var intN = trunc(n)
if n - intN >= 0.5 {
intN += 1
}
let result = (2 * max) / (pow(2,intN))
return result
}

in FrameImagesView.swift
func indexWithPosition(_ position:CGFloat) -> Int{
let index = position * CGFloat(thumbnailCountFloat()) / frame.size.width
let indexround = round(index)
let doubleToString = "(indexround)"
let indexInt = (doubleToString as NSString).integerValue
return indexInt
}

@vargrgrgr
Copy link
Author

in centerline.swift
func setTimeText() {
let minute = trunc(currentTime / 60)
let second = (currentTime - Float64(minute) * 60)
let truncsec = trunc(second)
let milliSec = Int((second - Float64(truncsec)) * 100)
let text = String(format: "%02d:%02d.%02d", minute, (Int(second)), milliSec)
timeLabel.text = text
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant