Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked October 28th 2010 by Mattia Zanetti
  • iphone
  • movie
  • video
0 Comments

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

    — answered November 6th 2010 by Paul Dowsett
    permalink
    1 Comment
    • I don't see the resume information, and play isn't resuming the video for me.

      — commented April 4th 2011 by David Smith
  • 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);
    
    — answered July 19th 2011 by Mark Pemburn
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.