You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// copies of the Software, and to permit persons to whom the Software is
10
+
// furnished to do so, subject to the following conditions:
7
11
//
12
+
// The above copyright notice and this permission notice shall be included in
13
+
// all copies or substantial portions of the Software.
14
+
//
15
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+
// THE SOFTWARE.
8
22
9
23
import UIKit
10
24
11
-
classTimelineView:UIView{
25
+
publicclassTimelineView:UIView{
12
26
13
27
// MARK: - Vars
14
28
15
-
varduration:Double=0.0{
29
+
/// The duration of the video in seconds.
30
+
publicvarduration:NSTimeInterval=0.0{
16
31
didSet {setNeedsDisplay()}
17
32
}
18
33
19
-
varinitialTime:Double=0.0{
34
+
/// Time in seconds when rewind began.
35
+
publicvarinitialTime:NSTimeInterval=0.0{
20
36
didSet {
21
37
currentTime = initialTime
22
38
}
23
39
}
24
40
25
-
varcurrentTime:Double=0.0{
41
+
/// Current timeline time in seconds.
42
+
publicvarcurrentTime:NSTimeInterval=0.0{
26
43
didSet {
27
44
setNeedsDisplay()
28
45
currentTimeDidChange?(currentTime)
29
46
}
30
47
}
31
48
49
+
/// Internal zoom variable.
32
50
privatevar_zoom:CGFloat=1.0{
33
51
didSet {setNeedsDisplay()}
34
52
}
35
53
36
-
varzoom:CGFloat{
54
+
/// The zoom of the timeline view. The higher zoom value, the more accurate rewind is. Default is 1.0.
55
+
publicvarzoom:CGFloat{
37
56
get{return _zoom }
38
57
set{ _zoom =max(min(newValue, maxZoom), minZoom)}
39
58
}
40
59
41
-
varminZoom:CGFloat=1.0{
60
+
/// Indicates minimum zoom value. Default is 1.0.
61
+
publicvarminZoom:CGFloat=1.0{
42
62
didSet { zoom = _zoom }
43
63
}
44
64
45
-
varmaxZoom:CGFloat=3.5{
65
+
/// Indicates maximum zoom value. Default is 3.5.
66
+
publicvarmaxZoom:CGFloat=3.5{
46
67
didSet { zoom = _zoom }
47
68
}
48
69
49
-
varintervalWidth:CGFloat=24.0{
70
+
/// The width of a line representing a specific time interval on a timeline. If zoom is not equal 1, then actual interval width equals to intervalWidth * zoom. Value will be used during rewind for calculations — for example, if zoom is 1, intervalWidth is 30 and intervalDuration is 15, then when user moves 10pixels left or right we will rewind by +5 or -5 seconds;
71
+
publicvarintervalWidth:CGFloat=24.0{
50
72
didSet {setNeedsDisplay()}
51
73
}
52
74
53
-
varintervalDuration:CGFloat=15.0{
75
+
/// The duration of an interval in seconds. If video is 55 seconds and interval is 15 seconds — then we will have 3 full intervals and one not full interval. Value will be used during rewind for calculations.
76
+
publicvarintervalDuration:CGFloat=15.0{
54
77
didSet {setNeedsDisplay()}
55
78
}
56
79
57
-
varcurrentTimeDidChange:((Double)->())?
80
+
/// Block which will be triggered everytime currentTime value changes.
0 commit comments