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

#view_finder_viewObject

Returns the value of attribute view_finder_view.



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

def view_finder_view
  @view_finder_view
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

#rotate_camera_to(new_frame, orientation: to_interface_orientation, 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
69
70
71
# File 'lib/AVClub/AVClubController.rb', line 40

def rotate_camera_to(new_frame, orientation:to_interface_orientation, duration:duration)
  return unless @view_finder_view

  capture_video_preview_layer = nil
  @view_finder_view.layer.sublayers.each do |layer|
    if layer.is_a? AVCaptureVideoPreviewLayer
      capture_video_preview_layer = layer
      break
    end
  end
  return unless capture_video_preview_layer

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

  capture_video_preview_layer.masksToBounds = true
  UIView.animateWithDuration(duration, animations:lambda{
    transform = CATransform3DMakeRotation(rotation, 0, 0, 1.0)
    capture_video_preview_layer.anchorPoint = [0.5, 0.5]
    capture_video_preview_layer.transform = transform
    capture_video_preview_layer.frame = new_frame
    club.orientation = to_interface_orientation
  })
end

#start_in_view(view) ⇒ Object



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

def start_in_view(view)
  @view_finder_view = view

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