Pause VIdeo
Hi, in Titanium Mobile, can i stop a video and then resume at the same point? I know that exist method pause(), but how do i resume video? Thanks
2 Answers
-
On 12 March the apidocs were updated with the pause/resume information in master on github, so I am not sure why it hasn't been published yet. Apparently, the play() method is used to resume a video. See VideoPlayer.tdoc
-
Not sure how you're coding it but .play() does resume a paused video.
Here's how I am doing it:
function VideoPlayback(win) { var self = this; this.win = win; this.activeMovie = null; this.isPaused = false; this.draw = function () { self.activeMovie = Ti.Media.createVideoPlayer({ url: 'sample.mov' }); self.playPauseButton = Ti.UI.createButton({ backgroundImage: 'pause.png' }); self.playPauseButton.addEventListener('click', function (e) { if (!self.isPaused) { self.activeMovie.pause(); self.playPauseButton.backgroundImage = 'play.png'; } else { self.activeMovie.play(); self.playPauseButton.backgroundImage = 'pause.png'; } self.isPaused =! self.isPaused; }); self.win.add(self.activeMovie); self.win.add(self.playPauseButton); }; this.draw(); } var vid = new VideoPlayback(Ti.UI.currentWindow);