Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12230] BlackBerry: Implement important Titanium.Media.VideoPlayer functionality

GitHub Issuen/a
TypeStory
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-07-12T17:03:02.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 14, 2013 Sprint 14 API, Release 3.1.2, Release 3.2.0
ComponentsBlackBerry
Labelsdocumentation, notable, qe-testadded
ReporterRussell McMahon
AssigneeRussell McMahon
Created2013-01-07T11:56:02.000+0000
Updated2017-03-09T07:53:14.000+0000

Description

Attachments

FileDateSize
efencefun.mp42013-07-26T22:55:23.000+00004698306

Comments

  1. Pedro Enrique 2013-07-12

    PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/123 Merged. Quick note, this seems to only be working on BB device, tested on Mac.
  2. Russell McMahon 2013-07-12

    We need to document that the video player only works on device. Although some codecs may work it appears common ones, like mp3, mp4 do not work and there does not appear to be BB docs that list the codecs that work on simulator. http://supportforums.blackberry.com/t5/Cascades-Development/MediaPlayer-playing-an-MP3/m-p/1931967/highlight/true#M4251
  3. Russell McMahon 2013-07-26

       
       var vidWin = Titanium.UI.createWindow({
           title : 'Video View Demo',
           backgroundColor : 'red',
           layout: 'vertical'
       });
       
       var startStopButton = Titanium.UI.createButton({
           title:'Start/Stop Streaming',
           top:20,
           width:300
       });
       
       var pauseResumeButton = Titanium.UI.createButton({
           title:'Pause/Resume Streaming',
           top:20,
           width:300,
           enabled:false
       });
       
       var videoPlayer = Titanium.Media.createVideoPlayer({
           top : 20,
           height : 300,
           width : 300
       });
       
       vidWin.add(startStopButton);
       vidWin.add(pauseResumeButton);
       
       startStopButton.addEventListener('click',function() {
           // When paused, playing returns false.
           // If both are false, playback is stopped.
           if (videoPlayer.playing || videoPlayer.paused)
           {
               videoPlayer.stop();
               pauseResumeButton.enabled = false;
               videoPlayer.release();
           }
           else
           {
               videoPlayer.start();
               pauseResumeButton.enabled = true;
           }
       });
       
       pauseResumeButton.addEventListener('click', function() {
           if (videoPlayer.paused) {
               videoPlayer.start();
           }
           else {
               videoPlayer.pause();
           }
       });
       
       videoPlayer.addEventListener('progress',function(e) {
           Ti.API.info('Time Played: ' + Math.round(e.progress) + ' milliseconds');
       });
       
       videoPlayer.addEventListener('change',function(e)
       {
           Ti.API.info('State: ' + e.description + ' (' + e.state + ')');
           
           // currently blackberry does not support scaling but by hooking this
           // change event and getting the actual video dimensions the developer can scale 
           // or do and boxing that may be necessary
           videoPlayer.width = e.videoWidth/2;
           videoPlayer.height = e.videoHeight/2;
       });
       
       videoPlayer.addEventListener('completed',function(e)
       {
           Ti.API.info('media completed');
       });
       
       vidWin.addEventListener('close',function() {
       
           videoPlayer.stop();
           videoPlayer.release();
       });
       
       
       videoPlayer.url = 'video/efencefun.mp4';
       vidWin.add(videoPlayer);
       vidWin.open();
       
       
  4. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source