Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4207] Media.createVideoPlayer requires CAMERA_PERMISSION

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-08T11:42:52.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sRelease 1.8.0
ComponentsAndroid
Labelsn/a
ReporterDawson Toth
AssigneeDon Thorp
Created2011-05-24T16:51:35.000+0000
Updated2011-06-28T12:49:21.000+0000

Description

Problem

Using Ti.Media.createVideoPlayer adds the camera permissions to the resulting AndroidManifest.xml.

Solution

Edit builder.py to remove this relationship (I'll send a pull request on Ti Mobile with this change).

Associated Helpdesk Ticket

http://appc.me/c/APP-744612

Comments

  1. Dawson Toth 2011-05-24

    Pull Request

    https://github.com/appcelerator/titanium_mobile/pull/100
  2. Dawson Toth 2011-06-08

    Sample Code

    Drop the following in an app.js to test this change. It downloads a 7mb video and plays it in a video player.
       var videoLink = 'http://photosbydawson.com/resources/yoyo.mp4';
       var videoFile = Ti.Filesystem.getFile('file:///sdcard/').exists()
               ? Ti.Filesystem.getFile('file:///sdcard/yoyo.mp4')
               : Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'yoyo.mp4');
       
       var win = Ti.UI.createWindow({ backgroundColor: '#000' });
       win.open();
       
       function downloadVideo() {
           var progressBar = Ti.UI.createProgressBar({
               max: 1, min: 0, value: 0,
               visible: true
           });
           win.add(progressBar);
           var xmlHttpObj = Ti.Network.createHTTPClient({
               ondatastream: function(e) {
                   progressBar.value = e.progress;
               },
               onreadystatechange: function() {
                   if (xmlHttpObj.readyState == 4) {
                       videoFile.write(xmlHttpObj.responseData);
                       win.remove(progressBar);
                       playVideo();
                   }
               }
           });
           xmlHttpObj.open('GET', videoLink);
           xmlHttpObj.send();
       }
       
       function playVideo() {
           var videoPlayer = Ti.Media.createVideoPlayer({
               url: videoFile.nativePath
           });
           if (parseFloat(Ti.Platform.version) >= 3.2) {
               win.add(videoPlayer);
           }
           videoPlayer.play();
       }
       
       if (videoFile.exists()) {
           playVideo();
       }
       else {
           downloadVideo();
       }
       
  3. Thomas Huelbert 2011-06-28

    closing against 1.8.0.v20110628104237. confirmed on galaxy pad (2.2.1), xoom (3.1) opening a new issue for the droid 1 as per Don.

JSON Source