Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 23 | Rev 28 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 23 Rev 25
Línea 42... Línea 42...
42
            slideTitle = String(Array(self.slideModel.name)[0...Constants.APP_BAR_TITLE_MAX_LENGTH]) + "..."
42
            slideTitle = String(Array(self.slideModel.name)[0...Constants.APP_BAR_TITLE_MAX_LENGTH]) + "..."
43
        } else {
43
        } else {
44
            slideTitle = self.slideModel.name
44
            slideTitle = self.slideModel.name
45
        }
45
        }
Línea 46... Línea -...
46
        
-
 
47
 
46
        
48
        let headerSecurity = HeaderSecurity()
-
 
49
        
-
 
50
        let headers: [String: String] = [
-
 
51
            Constants.HTTP_HEADER_ACCEPT: Constants.HTTP_HEADER_ACCEPT_VALUE,
-
 
52
            Constants.HTTP_HEADER_SECURITY_RAND: String(headerSecurity.rand),
-
 
53
            Constants.HTTP_HEADER_SECURITY_TOKEN: appData.deviceUuid,
-
 
54
            Constants.HTTP_HEADER_SECURITY_CREATED: String(headerSecurity.created) ,
-
 
55
            Constants.HTTP_HEADER_SECURITY_SECRET: headerSecurity.secret,
-
 
56
        ]
-
 
57
        
-
 
58
        let assets = AVURLAsset(url: self.url!, options: ["AVURLAssetHTTPHeaderFieldsKey": headers])
-
 
59
 
47
        let assets = AVURLAsset(url: self.url!)
60
        playerItem = AVPlayerItem(asset: assets)
48
        playerItem = AVPlayerItem(asset: assets)
Línea 61... Línea 49...
61
        let newTime : CMTime = CMTimeMakeWithSeconds(0, preferredTimescale:1)
49
        let newTime : CMTime = CMTimeMakeWithSeconds(0, preferredTimescale:1)
62
        
50
        
63
        player = AVPlayer(playerItem: playerItem)
-
 
64
        player.seek(to: newTime)
-
 
65
      
-
 
66
      
-
 
67
        self.timerActive = true
-
 
68
 
-
 
Línea 69... Línea 51...
69
        
51
        player = AVPlayer(playerItem: playerItem)
Línea 70... Línea 52...
70
 
52
        player.seek(to: newTime)
71
 
53
 
Línea 116... Línea 98...
116
                    let duration =  CMTimeGetSeconds(playerItem.asset.duration)
98
                    let duration =  CMTimeGetSeconds(playerItem.asset.duration)
117
                    if duration > 0 {
99
                    if duration > 0 {
Línea 118... Línea 100...
118
 
100
 
119
                        let currentTime =  CMTimeGetSeconds(playerItem.currentTime())
101
                        let currentTime =  CMTimeGetSeconds(playerItem.currentTime())
120
                            let diference = duration - currentTime
102
                            let diference = duration - currentTime
-
 
103
                                 
-
 
104
                        print("duration: \(duration) currentTime : \(currentTime) diference: \(diference) ")
121
                                   
105
                        
122
                            if diference < 10 {
106
                            if diference < 10 {
123
                                self.isCompleted = true;
107
                                self.isCompleted = true;
-
 
108
                            } else if diference <= 0 {
-
 
109
                                self.isCompleted = true;
124
                            } else if diference <= 0 {
110
                                
125
                                self.timer.upstream.connect().cancel()
111
                                self.timer.upstream.connect().cancel()
126
                                timerActive = false
112
                                timerActive = false
127
                                backToGallery()
113
                                backToGallery()