2 // VLCPlayerController.m
5 // Created by hyei on 06/09/07.
6 // Copyright 2007 __MyCompanyName__. All rights reserved.
9 #import "VLCPlayerController.h"
11 #import <BackRow/BREvent.h>
12 #import <BackRow/BRLayer.h>
13 #import <BackRow/BRControllerStack.h>
15 @implementation VLCPlayerController
21 BRLayer * layer = [self layer];
22 _mediaLayer = [VLCMediaLayer layer];
23 _mediaLayer.frame = layer.bounds;
24 _mediaLayer.autoresizingMask = kCALayerWidthSizable|kCALayerHeightSizable;
26 [layer addSublayer:_mediaLayer];
33 return [_mediaLayer media];
36 - (void)setMedia:(VLCMedia *)media
38 _mediaLayer.media = media;
41 - (void)brEventAction:(BREvent*)event
43 BREventUsage usage = [event usage];
44 BREventValue value = [event value];
45 VLCMediaPlayer * player = [_mediaLayer player];
47 NSLog(@"usage: %d value: %d", usage, value);
51 [_mediaLayer playPause];
53 case BREventRightUsage:
56 float position = [player position];
58 position = MIN(1.0, MAX(0.0, position));
59 [player setPosition:position];
62 case BREventLeftUsage:
65 float position = [player position];
67 position = MIN(1.0, MAX(0.0, position));
68 [player setPosition:position];
74 [[[VLCLibrary sharedLibrary] audio] setVolume:[[[VLCLibrary sharedLibrary] audio] volume]+20];
77 case BREventDownUsage:
80 [[[VLCLibrary sharedLibrary] audio] setVolume:[[[VLCLibrary sharedLibrary] audio] volume]-20];
83 case BREventMenuUsage:
84 [[self stack] popController];
90 - (BOOL)firstResponder
95 - (void)controlWillDeactivate
97 [_mediaLayer.player pause];
98 [super controlWillDeactivate];
101 - (void)controlWasActivated
103 [super controlWasActivated];
104 [_mediaLayer.player play];