                 self.pendingOffset = offset
                 return
             }
-            let timeSec = videoStart + offset * videoDuration
+            let timeSec = videoStart + offset * (videoDuration ?? 1.0)
             let time = CMTimeMakeWithSeconds(Float64(timeSec), 600)
             let tolerance = CMTimeMake(10, 600) // 1/60sec
             if player.status == AVPlayerStatus.readyToPlay {

            if let urlVideo = urlLocalOrStream {
                let playerItem = AVPlayerItem(url: urlVideo)
                videoPlayer.replaceCurrentItem(with: playerItem)

                notificationManager.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: playerItem, queue: OperationQueue.main) {
                    [unowned self] (_:Notification!) -> Void in
                    MyLog("SWElem play to end!", level: 1)
                    if self.delegate != nil && self.delegate!.shouldRepeat(self) {
                        videoPlayer.seek(to: kCMTimeZero)
                        videoPlayer.play()
                    } else {
                        self.fNeedRewind = true
                        if self.fPlaying {
                            self.fPlaying = false
                            self.delegate.didFinishPlaying(self, completed:true)
                        }
                    }
                }
            }
            

        }
    }
*/
    func handleVideoEnd(videoPlayer:AVPlayer) {
        if self.delegate != nil && self.delegate!.shouldRepeat(self) {
            videoPlayer.seek(to: CMTime(seconds:Double(self.videoStart), preferredTimescale: 600))
            videoPlayer.play()
        } else {
            self.fNeedRewind = true
            if self.fPlaying {
                self.fPlaying = false
                self.delegate.didFinishPlaying(self, completed:true)
            }
        }
    }
    
    func isVideoElement() -> Bool {
        if self.videoPlayer != nil {
            return true
