Class: AVClubController

Inherits:
UIViewController
  • Object
show all
Defined in:
lib/AVClub/AVClubController.rb

Direct Known Subclasses

CameraController

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#club(club, assetSavedToURL: url, error: error) ⇒ Object

Returns the value of attribute club.



2
3
4
# File 'lib/AVClub/AVClubController.rb', line 2

def club
  @club
end

#viewFinderViewObject

Returns the value of attribute viewFinderView.



3
4
5
# File 'lib/AVClub/AVClubController.rb', line 3

def viewFinderView
  @viewFinderView
end

Instance Method Details

#clubDeviceConfigurationChanged(club) ⇒ Object



37
38
# File 'lib/AVClub/AVClubController.rb', line 37

def clubDeviceConfigurationChanged(club)
end

#clubRecordingBegan(club) ⇒ Object



31
32
# File 'lib/AVClub/AVClubController.rb', line 31

def clubRecordingBegan(club)
end

#clubRecordingFinished(club) ⇒ Object



34
35
# File 'lib/AVClub/AVClubController.rb', line 34

def clubRecordingFinished(club)
end

#rotateCameraTo(new_frame, orientation: toInterfaceOrientation, duration: duration) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/AVClub/AVClubController.rb', line 40

def rotateCameraTo(new_frame, orientation:toInterfaceOrientation, duration:duration)
  return unless viewFinderView

  captureVideoPreviewLayer = nil
  viewFinderView.layer.sublayers.each do |layer|
    if layer.is_a? AVCaptureVideoPreviewLayer
      captureVideoPreviewLayer = layer
      break
    end
  end
  return unless captureVideoPreviewLayer

  case toInterfaceOrientation
  when UIInterfaceOrientationLandscapeLeft
    rotation = Math::PI / 2
  when UIInterfaceOrientationLandscapeRight
    rotation = -Math::PI / 2
  when UIInterfaceOrientationPortrait
    rotation = 0
  when UIInterfaceOrientationPortraitUpsideDown
    rotation = 2 * Math::PI
  end

  captureVideoPreviewLayer.masksToBounds = true
  UIView.animateWithDuration(duration, animations:lambda{
    captureVideoPreviewLayer.frame = new_frame
    captureVideoPreviewLayer.orientation = toInterfaceOrientation
  })
end

#startInView(view) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/AVClub/AVClubController.rb', line 5

def startInView(view)
  self.viewFinderView = view

  unless club
    self.club = AVClub.new
    self.club.delegate = self
    self.club.startInView(view)
  end
end