Update theme submodule
[platform/upstream/gstreamer.git] / examples / tutorials / xcode iOS / Tutorial 2 / ViewController.m
1 #import "ViewController.h"
2 #import "GStreamerBackend.h"
3 #import <UIKit/UIKit.h>
4
5 @interface ViewController () {
6     GStreamerBackend *gst_backend;
7 }
8
9 @end
10
11 @implementation ViewController
12
13 /*
14  * Methods from UIViewController
15  */
16
17 - (void)viewDidLoad
18 {
19     [super viewDidLoad];
20
21     play_button.enabled = FALSE;
22     pause_button.enabled = FALSE;
23
24     gst_backend = [[GStreamerBackend alloc] init:self];
25 }
26
27 - (void)didReceiveMemoryWarning
28 {
29     [super didReceiveMemoryWarning];
30     // Dispose of any resources that can be recreated.
31 }
32
33 /* Called when the Play button is pressed */
34 -(IBAction) play:(id)sender
35 {
36     [gst_backend play];
37 }
38
39 /* Called when the Pause button is pressed */
40 -(IBAction) pause:(id)sender
41 {
42     [gst_backend pause];
43 }
44
45 /*
46  * Methods from GstreamerBackendDelegate
47  */
48
49 -(void) gstreamerInitialized
50 {
51     dispatch_async(dispatch_get_main_queue(), ^{
52         play_button.enabled = TRUE;
53         pause_button.enabled = TRUE;
54         message_label.text = @"Ready";
55     });
56 }
57
58 -(void) gstreamerSetUIMessage:(NSString *)message
59 {
60     dispatch_async(dispatch_get_main_queue(), ^{
61         message_label.text = message;
62     });
63 }
64
65 @end