Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15618

Titanium.Media.VideoPlayer fires COMPLETE event when url changes

    Details

      Description

      After changing the Titanium.Media.VideoPlayer.url value the videoPlayer fires a onComplete event that should not be fired, or at least fired including the real reason for it, but currently the event.reason is 0 (Ti.Media.VIDEO_FINISH_REASON_PLAYBACK_ENDED).

      This is causing a lot of trouble to create a playlist app.
      We could have a VIDEO_FINISH_REASON_SOURCE_CHANGED as a new reason, would be way better

      This is a very old topic: http://developer.appcelerator.com/question/121674/complete-event-firing-when-changing-url-on-video-player

      var win1 = Titanium.UI.createWindow({  
          title:'Tab 1',
          backgroundColor:'#fff',
       
      });
       
      var videoPlayer = Ti.Media.createVideoPlayer({
      	backgroundColor:'#fff',	
      	autoplay:true,
      	url:'firstSong.mp3'
      })
       
      videoPlayer.addEventListener('complete',function(e){
      	Ti.API.info('========')
      	Ti.API.info('complete event fired - ' + JSON.stringify(e))
      	Ti.API.info('Event reason should not be 0 but it is ' + e.reason)
      	Ti.API.info('========')	
      })
       
      var nextSongBtn = Ti.UI.createButton({
      	top:100,
      	title:'Click to change the music' 
      })
      nextSongBtn.addEventListener('click',function(){
      	videoPlayer.url = 'mynewfile.mp3';	
      })
       
       
      win1.add(videoPlayer);
      win1.add(nextSongBtn);
       
      win1.open();
       
      //Current playback reasons, here we could have a VIDEO_FINISH_REASON_SOURCE_CHANGED as a new reason
      Ti.API.info('Ti.Media.VIDEO_FINISH_REASON_PLAYBACK_ENDED = ' + Ti.Media.VIDEO_FINISH_REASON_PLAYBACK_ENDED)
      Ti.API.info('Ti.Media.VIDEO_FINISH_REASON_PLAYBACK_ERROR = ' + Ti.Media.VIDEO_FINISH_REASON_PLAYBACK_ERROR)
      Ti.API.info('Ti.Media.VIDEO_FINISH_REASON_USER_EXITED = ' + Ti.Media.VIDEO_FINISH_REASON_USER_EXITED)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cleison.ezoom Ezoom Agency
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17741
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration