Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: Release 1.4.0
    • Component/s: iOS
    • Labels:

      Description

      {html}<div><p>see attached example. toggle flash to on, take picture and app
      freezes</p>
      <pre>
      <code class="javascript">
      // this sets the background color of the master UIView (when there are no windows/tab groups on it)
      Titanium.UI.setBackgroundColor('FFF');

      // create tab group
      var tabGroup = Titanium.UI.createTabGroup();

      //
      // create base UI tab and root window
      //
      var win1 = Titanium.UI.createWindow({
      title:'Camera Flash Test',
      backgroundColor:'#fff'
      });
      var tab1 = Titanium.UI.createTab({
      icon:'KS_nav_views.png',
      title:'Camera',
      window:win1
      });

      function isiOS4Plus()
      {
      // add iphone specific tests
      if (Titanium.Platform.name == 'iPhone OS')
      {
      var version = Titanium.Platform.version.split(".");
      var major = parseInt(version[0], 10);

      // can only test this support on a 3.2+ device
      if (major >= 4)
      { return true; }
      }
      return false;
      }

      var cameraButton = Ti.UI.createButton({
      title:'Camera Test',
      height:40,
      width: 280,
      left:20,
      top:300
      });
      cameraButton.addEventListener('click', function () {

      if (isiOS4Plus())
      { Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_OFF; }

      var overlayView = Ti.UI.createView({ height:480, width:320, backgroundColor:'transparent' });

      var cameraFlash = Titanium.UI.createButton({ title:'Flash: Off', height:30, width:100, left:20, top:20, borderRadius:8 });
      cameraFlash.addEventListener('click', function() {

      if (!isiOS4Plus())
      { return; }

      if (Ti.Media.cameraFlashMode == Ti.Media.CAMERA_FLASH_ON)
      { cameraFlash.title = "Flash: Off"; Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_OFF; }
      else
      { cameraFlash.title = "Flash: On"; Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_ON; }
      });

      var button1 = Titanium.UI.createButton({ title:'Shoot', height:40, width:100, left:110, top:5 });
      button1.addEventListener('click', function() { Ti.Media.takePicture(); });

      var button2 = Titanium.UI.createButton({ title:'Done', height:40, width:100, left:5, top:5 });
      button2.addEventListener('click', function() { Ti.Media.hideCamera(); });

      var background = Ti.UI.createView({ height:50, width:320, backgroundColor:'black', bottom:0 });

      background.add(button1);
      background.add(button2);

      overlayView.add(background);
      overlayView.add(cameraFlash);

      Titanium.Media.showCamera({

      success:function(event)
      {
      },

      cancel:function()
      {
      },
      error:function(error)
      {
      },
      showControls:false,
      allowImageEditing:false,
      autohide:false,
      mediaTypes:Ti.Media.MEDIA_TYPE_PHOTO,
      overlay:overlayView,
      saveToPhotoGallery:true
      });
      });


      win1.add(cameraButton);

      tabGroup.addTab(tab1);

      // open tab group
      tabGroup.open();</code>
      </pre></div>{html}

        Attachments

          Activity

            People

            • Assignee:
              jhaynie Jeff Haynie (Inactive)
              Reporter:
              nwright Nolan Wright (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code