mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 19:31:12 +00:00
Large revamp to bring it closer to the Android tutorial 2.
This commit is contained in:
parent
1e071cd730
commit
c27858631d
7 changed files with 218 additions and 151 deletions
|
@ -3,12 +3,7 @@
|
||||||
|
|
||||||
@interface GStreamerBackend : NSObject
|
@interface GStreamerBackend : NSObject
|
||||||
|
|
||||||
@property (nonatomic,assign) id delegate;
|
-(id) init:(id) uiDelegate;
|
||||||
|
|
||||||
-(NSString*) getGStreamerVersion;
|
|
||||||
|
|
||||||
-(BOOL) initializePipeline;
|
|
||||||
|
|
||||||
-(void) play;
|
-(void) play;
|
||||||
-(void) pause;
|
-(void) pause;
|
||||||
-(void) stop;
|
-(void) stop;
|
||||||
|
|
|
@ -3,16 +3,33 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
@interface GStreamerBackend()
|
@interface GStreamerBackend()
|
||||||
-(void)notifyError:(gchar*) message;
|
-(void)setUIMessage:(gchar*) message;
|
||||||
-(void)notifyEos;
|
-(void)app_function;
|
||||||
-(void) _poll_gst_bus;
|
-(void)check_initialization_complete;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GStreamerBackend {
|
@implementation GStreamerBackend {
|
||||||
GstElement *pipeline;
|
id delegate; /* Class that we use to interact with the user interface */
|
||||||
|
GstElement *pipeline; /* The running pipeline */
|
||||||
|
GMainContext *context; /* GLib context used to run the main loop */
|
||||||
|
GMainLoop *main_loop; /* GLib main loop */
|
||||||
|
gboolean initialized; /* To avoid informing the UI multiple times about the initialization */
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize delegate;
|
-(id) init:(id) uiDelegate
|
||||||
|
{
|
||||||
|
if (self = [super init])
|
||||||
|
{
|
||||||
|
self->delegate = uiDelegate;
|
||||||
|
|
||||||
|
/* Start the bus monitoring task */
|
||||||
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
|
[self app_function];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) dealloc
|
-(void) dealloc
|
||||||
{
|
{
|
||||||
|
@ -23,95 +40,120 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)notifyError:(gchar*) message
|
-(void)setUIMessage:(gchar*) message
|
||||||
{
|
{
|
||||||
NSString *string = [NSString stringWithUTF8String:message];
|
NSString *string = [NSString stringWithUTF8String:message];
|
||||||
if(delegate && [delegate respondsToSelector:@selector(gstreamerError:from:)])
|
if(delegate && [delegate respondsToSelector:@selector(gstreamerSetUIMessage:)])
|
||||||
{
|
{
|
||||||
[delegate gstreamerError:string from:self];
|
[delegate gstreamerSetUIMessage:string];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)notifyEos
|
/* Retrieve errors from the bus and show them on the UI */
|
||||||
|
static void error_cb (GstBus *bus, GstMessage *msg, GStreamerBackend *self)
|
||||||
{
|
{
|
||||||
if(delegate && [delegate respondsToSelector:@selector(gstreamerEosFrom)])
|
GError *err;
|
||||||
{
|
gchar *debug_info;
|
||||||
[delegate gstreamerEosFrom:self];
|
gchar *message_string;
|
||||||
|
|
||||||
|
gst_message_parse_error (msg, &err, &debug_info);
|
||||||
|
message_string = g_strdup_printf ("Error received from element %s: %s", GST_OBJECT_NAME (msg->src), err->message);
|
||||||
|
g_clear_error (&err);
|
||||||
|
g_free (debug_info);
|
||||||
|
[self setUIMessage:message_string];
|
||||||
|
g_free (message_string);
|
||||||
|
gst_element_set_state (self->pipeline, GST_STATE_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notify UI about pipeline state changes */
|
||||||
|
static void state_changed_cb (GstBus *bus, GstMessage *msg, GStreamerBackend *self)
|
||||||
|
{
|
||||||
|
GstState old_state, new_state, pending_state;
|
||||||
|
gst_message_parse_state_changed (msg, &old_state, &new_state, &pending_state);
|
||||||
|
/* Only pay attention to messages coming from the pipeline, not its children */
|
||||||
|
if (GST_MESSAGE_SRC (msg) == GST_OBJECT (self->pipeline)) {
|
||||||
|
gchar *message = g_strdup_printf("State changed to %s", gst_element_state_get_name(new_state));
|
||||||
|
[self setUIMessage:message];
|
||||||
|
g_free (message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) _poll_gst_bus
|
/* Check if all conditions are met to report GStreamer as initialized.
|
||||||
|
* These conditions will change depending on the application */
|
||||||
|
-(void) check_initialization_complete
|
||||||
|
{
|
||||||
|
if (!initialized && main_loop) {
|
||||||
|
GST_DEBUG ("Initialization complete, notifying application.");
|
||||||
|
if (delegate && [delegate respondsToSelector:@selector(gstreamerInitialized)])
|
||||||
|
{
|
||||||
|
[delegate gstreamerInitialized];
|
||||||
|
}
|
||||||
|
initialized = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main method for the native code. This is executed on its own thread. */
|
||||||
|
-(void) app_function
|
||||||
{
|
{
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GstMessage *msg;
|
GSource *bus_source;
|
||||||
|
|
||||||
/* Wait until error or EOS */
|
|
||||||
bus = gst_element_get_bus (self->pipeline);
|
|
||||||
msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE,
|
|
||||||
(GstMessageType) (GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
|
|
||||||
gst_object_unref(bus);
|
|
||||||
|
|
||||||
switch (GST_MESSAGE_TYPE(msg)) {
|
|
||||||
case GST_MESSAGE_EOS:
|
|
||||||
[self stop];
|
|
||||||
[self notifyEos];
|
|
||||||
NSLog(@"EOS");
|
|
||||||
break;
|
|
||||||
case GST_MESSAGE_ERROR: {
|
|
||||||
GError *gerr = NULL;
|
|
||||||
gchar *debug;
|
|
||||||
|
|
||||||
gst_message_parse_error(msg, &gerr, &debug);
|
|
||||||
|
|
||||||
[self stop];
|
|
||||||
NSLog(@"Error %s - %s", gerr->message, debug, nil);
|
|
||||||
[self notifyError:gerr->message];
|
|
||||||
g_free(debug);
|
|
||||||
g_error_free(gerr);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-(BOOL) initializePipeline
|
|
||||||
{
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (pipeline)
|
GST_DEBUG ("Creating pipeline");
|
||||||
return YES;
|
|
||||||
|
|
||||||
|
/* Create our own GLib Main Context and make it the default one */
|
||||||
|
context = g_main_context_new ();
|
||||||
|
g_main_context_push_thread_default(context);
|
||||||
|
|
||||||
|
/* Build pipeline */
|
||||||
pipeline = gst_parse_launch("audiotestsrc ! audioconvert ! audioresample ! autoaudiosink", &error);
|
pipeline = gst_parse_launch("audiotestsrc ! audioconvert ! audioresample ! autoaudiosink", &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
|
gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
[self notifyError:message];
|
[self setUIMessage:message];
|
||||||
g_free (message);
|
g_free (message);
|
||||||
return NO;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start the bus polling. This will the bus being continuously polled */
|
/* Instruct the bus to emit signals for each received message, and connect to the interesting signals */
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
bus = gst_element_get_bus (pipeline);
|
||||||
while (1) {
|
bus_source = gst_bus_create_watch (bus);
|
||||||
[self _poll_gst_bus];
|
g_source_set_callback (bus_source, (GSourceFunc) gst_bus_async_signal_func, NULL, NULL);
|
||||||
}
|
g_source_attach (bus_source, context);
|
||||||
});
|
g_source_unref (bus_source);
|
||||||
|
g_signal_connect (G_OBJECT (bus), "message::error", (GCallback)error_cb, (__bridge void *)self);
|
||||||
|
g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback)state_changed_cb, (__bridge void *)self);
|
||||||
|
gst_object_unref (bus);
|
||||||
|
|
||||||
return YES;
|
/* Create a GLib Main Loop and set it to run */
|
||||||
|
GST_DEBUG ("Entering main loop...");
|
||||||
|
main_loop = g_main_loop_new (context, FALSE);
|
||||||
|
[self check_initialization_complete];
|
||||||
|
g_main_loop_run (main_loop);
|
||||||
|
GST_DEBUG ("Exited main loop");
|
||||||
|
g_main_loop_unref (main_loop);
|
||||||
|
main_loop = NULL;
|
||||||
|
|
||||||
|
/* Free resources */
|
||||||
|
g_main_context_pop_thread_default(context);
|
||||||
|
g_main_context_unref (context);
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
gst_object_unref (pipeline);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) play
|
-(void) play
|
||||||
{
|
{
|
||||||
if(gst_element_set_state(pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
|
if(gst_element_set_state(pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
|
||||||
[self notifyError:"Failed to set pipeline to playing"];
|
[self setUIMessage:"Failed to set pipeline to playing"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) pause
|
-(void) pause
|
||||||
{
|
{
|
||||||
if(gst_element_set_state(pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
|
if(gst_element_set_state(pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
|
||||||
[self notifyError:"Failed to set pipeline to paused"];
|
[self setUIMessage:"Failed to set pipeline to paused"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,13 +163,5 @@
|
||||||
gst_element_set_state(pipeline, GST_STATE_NULL);
|
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSString*) getGStreamerVersion
|
|
||||||
{
|
|
||||||
char *str = gst_version_string();
|
|
||||||
NSString *version = [NSString stringWithUTF8String:str];
|
|
||||||
g_free(str);
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
@protocol GStreamerBackendDelegate <NSObject>
|
@protocol GStreamerBackendDelegate <NSObject>
|
||||||
|
|
||||||
@optional
|
@optional
|
||||||
-(void) gstreamerError:(NSString *)message from:(id)sender;
|
-(void) gstreamerInitialized;
|
||||||
-(void) gstreamerEosFrom:(id)sender;
|
-(void) gstreamerSetUIMessage:(NSString *)message;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
#import "GStreamerBackendDelegate.h"
|
#import "GStreamerBackendDelegate.h"
|
||||||
|
|
||||||
@interface ViewController : UIViewController <GStreamerBackendDelegate> {
|
@interface ViewController : UIViewController <GStreamerBackendDelegate> {
|
||||||
|
IBOutlet UILabel *message_label;
|
||||||
|
IBOutlet UIButton *play_button;
|
||||||
|
IBOutlet UIButton *pause_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) play:(id)sender;
|
-(IBAction) play:(id)sender;
|
||||||
-(IBAction) pause:(id)sender;
|
-(IBAction) pause:(id)sender;
|
||||||
|
|
||||||
/* From GStreamerBackendDelegate */
|
/* From GStreamerBackendDelegate */
|
||||||
-(void) gstreamerError:(NSString *)message from:(id)sender;
|
-(void) gstreamerInitialized;
|
||||||
-(void) gstreamerEosFrom:(id)sender;
|
-(void) gstreamerSetUIMessage:(NSString *)message;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -13,14 +13,11 @@
|
||||||
- (void)viewDidLoad
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view, typically from a nib.
|
|
||||||
|
|
||||||
gst_backend = [[GStreamerBackend alloc] init];
|
play_button.enabled = FALSE;
|
||||||
|
pause_button.enabled = FALSE;
|
||||||
|
|
||||||
if (![gst_backend initializePipeline]) {
|
gst_backend = [[GStreamerBackend alloc] init:self];
|
||||||
|
|
||||||
}
|
|
||||||
gst_backend.delegate = self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
- (void)didReceiveMemoryWarning
|
||||||
|
@ -39,28 +36,19 @@
|
||||||
[gst_backend pause];
|
[gst_backend pause];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) gstreamerError:(NSString *)message from:(id)sender
|
-(void) gstreamerInitialized
|
||||||
{
|
{
|
||||||
NSLog(@"Error %@", message, nil);
|
|
||||||
|
|
||||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"GStreamer error"
|
|
||||||
message:message
|
|
||||||
delegate:nil
|
|
||||||
cancelButtonTitle:@"OK"
|
|
||||||
otherButtonTitles:nil];
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
/* make sure it runs from the main thread */
|
play_button.enabled = TRUE;
|
||||||
[alert show];
|
pause_button.enabled = TRUE;
|
||||||
|
message_label.text = @"Ready";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) gstreamerEosFrom:(id)sender
|
-(void) gstreamerSetUIMessage:(NSString *)message
|
||||||
{
|
{
|
||||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"EOS" message:@"End of stream" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
|
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
/* make sure it runs from the main thread */
|
message_label.text = message;
|
||||||
[alert show];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,26 @@
|
||||||
<rect key="frame" x="0.0" y="20" width="768" height="1004"/>
|
<rect key="frame" x="0.0" y="20" width="768" height="1004"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nMR-rP-TAZ" userLabel="Buttons">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nMR-rP-TAZ" userLabel="Content">
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="elU-wp-Qp2">
|
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Initializing..." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="688" translatesAutoresizingMaskIntoConstraints="NO" id="UBA-ZM-cSe" userLabel="Message">
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="24"/>
|
||||||
|
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="elU-wp-Qp2" userLabel="Play">
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="180" type="user" id="uTI-bm-bpQ"/>
|
<constraint firstAttribute="height" constant="100" type="user" id="4hh-98-fyR"/>
|
||||||
|
<constraint firstAttribute="width" constant="400" type="user" id="uTI-bm-bpQ"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="32"/>
|
||||||
<state key="normal" title="Play">
|
<state key="normal" title="Play">
|
||||||
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
|
<state key="disabled">
|
||||||
|
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
</state>
|
||||||
<state key="highlighted">
|
<state key="highlighted">
|
||||||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
|
@ -30,15 +39,19 @@
|
||||||
<action selector="play:" destination="2" eventType="touchUpInside" id="Rji-r8-PDd"/>
|
<action selector="play:" destination="2" eventType="touchUpInside" id="Rji-r8-PDd"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="w2M-v5-UAa">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="w2M-v5-UAa" userLabel="Pause">
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="180" type="user" id="S8q-2J-07k"/>
|
<constraint firstAttribute="height" constant="100" type="user" id="L6h-G1-RwS"/>
|
||||||
|
<constraint firstAttribute="width" constant="400" type="user" id="S8q-2J-07k"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="32"/>
|
||||||
<state key="normal" title="Pause">
|
<state key="normal" title="Pause">
|
||||||
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
|
<state key="disabled">
|
||||||
|
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
</state>
|
||||||
<state key="highlighted">
|
<state key="highlighted">
|
||||||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
|
@ -47,28 +60,53 @@
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
|
<constraint firstItem="elU-wp-Qp2" firstAttribute="top" secondItem="UBA-ZM-cSe" secondAttribute="bottom" constant="8" symbolic="YES" type="user" id="18h-11-jhy"/>
|
||||||
|
<constraint firstItem="w2M-v5-UAa" firstAttribute="top" secondItem="elU-wp-Qp2" secondAttribute="bottom" constant="8" symbolic="YES" type="user" id="6GJ-37-EcB"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="w2M-v5-UAa" secondAttribute="centerX" type="user" id="7jU-ts-TJx"/>
|
<constraint firstAttribute="centerX" secondItem="w2M-v5-UAa" secondAttribute="centerX" type="user" id="7jU-ts-TJx"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="UBA-ZM-cSe" secondAttribute="trailing" constant="20" symbolic="YES" type="user" id="EkQ-sA-oVc"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="elU-wp-Qp2" secondAttribute="centerX" type="user" id="EuX-Nw-e9K"/>
|
<constraint firstAttribute="centerX" secondItem="elU-wp-Qp2" secondAttribute="centerX" type="user" id="EuX-Nw-e9K"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="w2M-v5-UAa" secondAttribute="bottom" constant="20" symbolic="YES" type="default" id="Rdi-ax-p63"/>
|
<constraint firstAttribute="bottom" secondItem="w2M-v5-UAa" secondAttribute="bottom" constant="20" symbolic="YES" type="default" id="LCr-Rv-UZs"/>
|
||||||
<constraint firstItem="w2M-v5-UAa" firstAttribute="top" secondItem="elU-wp-Qp2" secondAttribute="bottom" constant="8" symbolic="YES" type="default" id="ZJv-bm-2N8"/>
|
<constraint firstItem="UBA-ZM-cSe" firstAttribute="top" secondItem="nMR-rP-TAZ" secondAttribute="top" constant="20" symbolic="YES" type="user" id="nNG-sn-bRM"/>
|
||||||
<constraint firstItem="elU-wp-Qp2" firstAttribute="top" secondItem="nMR-rP-TAZ" secondAttribute="top" constant="20" symbolic="YES" type="default" id="etT-xj-mf4"/>
|
<constraint firstItem="UBA-ZM-cSe" firstAttribute="leading" secondItem="nMR-rP-TAZ" secondAttribute="leading" constant="20" symbolic="YES" type="user" id="pJE-Vl-N8j"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="nMR-rP-TAZ" firstAttribute="leading" secondItem="5" secondAttribute="leading" constant="20" symbolic="YES" type="user" id="E7n-88-e9Y"/>
|
<constraint firstItem="nMR-rP-TAZ" firstAttribute="leading" secondItem="5" secondAttribute="leading" constant="20" symbolic="YES" type="user" id="E7n-88-e9Y"/>
|
||||||
<constraint firstAttribute="centerY" secondItem="nMR-rP-TAZ" secondAttribute="centerY" type="user" id="VKP-3B-S4N"/>
|
<constraint firstAttribute="centerX" secondItem="nMR-rP-TAZ" secondAttribute="centerX" type="user" id="SAT-T4-FL2"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="nMR-rP-TAZ" secondAttribute="centerX" type="user" id="cFL-r5-ip5"/>
|
<constraint firstAttribute="centerY" secondItem="nMR-rP-TAZ" secondAttribute="centerY" type="user" id="SfA-hs-2KS"/>
|
||||||
|
<constraint firstItem="nMR-rP-TAZ" firstAttribute="top" secondItem="5" secondAttribute="top" priority="1" constant="20" symbolic="YES" type="user" id="XdK-Aa-fKA"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
|
<connections>
|
||||||
|
<outlet property="message_label" destination="UBA-ZM-cSe" id="o2e-1J-nKs"/>
|
||||||
|
<outlet property="pause_button" destination="w2M-v5-UAa" id="PKY-tN-Lod"/>
|
||||||
|
<outlet property="play_button" destination="elU-wp-Qp2" id="C54-Xz-aIt"/>
|
||||||
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="3" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="3" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
|
<classes>
|
||||||
|
<class className="NSLayoutConstraint" superclassName="NSObject">
|
||||||
|
<source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/>
|
||||||
|
</class>
|
||||||
|
<class className="ViewController" superclassName="UIViewController">
|
||||||
|
<source key="sourceIdentifier" type="project" relativePath="./Classes/ViewController.h"/>
|
||||||
|
<relationships>
|
||||||
|
<relationship kind="action" name="pause:"/>
|
||||||
|
<relationship kind="action" name="play:"/>
|
||||||
|
<relationship kind="outlet" name="label" candidateClass="UILabel"/>
|
||||||
|
<relationship kind="outlet" name="message_label" candidateClass="UILabel"/>
|
||||||
|
<relationship kind="outlet" name="pause_button" candidateClass="UIButton"/>
|
||||||
|
<relationship kind="outlet" name="play_button" candidateClass="UIButton"/>
|
||||||
|
</relationships>
|
||||||
|
</class>
|
||||||
|
</classes>
|
||||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||||
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
|
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
|
||||||
<simulatedOrientationMetrics key="orientation"/>
|
<simulatedOrientationMetrics key="orientation"/>
|
||||||
|
|
|
@ -1,89 +1,98 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="11G63" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="pxQ-Ha-9Mf">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="11G63" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kYn-Hr-MJq">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--View Controller-->
|
<!--View Controller-->
|
||||||
<scene sceneID="Vig-3P-QBd">
|
<scene sceneID="3nc-d3-XH9">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="pxQ-Ha-9Mf" customClass="ViewController" sceneMemberID="viewController">
|
<viewController id="kYn-Hr-MJq" customClass="ViewController" sceneMemberID="viewController">
|
||||||
<view key="view" contentMode="scaleToFill" id="OMs-0e-qTd">
|
<view key="view" contentMode="scaleToFill" id="JOS-rK-Hts">
|
||||||
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
|
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GxN-0E-u6U" userLabel="Buttons">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pac-D3-jCF" userLabel="Content">
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vb0-jC-MBX">
|
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Initializing..." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="240" translatesAutoresizingMaskIntoConstraints="NO" id="8wd-E5-Owx" userLabel="Message">
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||||
|
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uVI-yQ-geg" userLabel="Play">
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="180" type="user" id="JWj-Ts-QpO"/>
|
<constraint firstAttribute="height" constant="100" type="user" id="D1U-D7-pGb"/>
|
||||||
|
<constraint firstAttribute="width" constant="200" type="user" id="H9m-EA-1Y9"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
|
||||||
<state key="normal" title="Play">
|
<state key="normal" title="Play">
|
||||||
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
|
<state key="disabled">
|
||||||
|
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
</state>
|
||||||
<state key="highlighted">
|
<state key="highlighted">
|
||||||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="play:" destination="pxQ-Ha-9Mf" eventType="touchUpInside" id="720-pe-ZQg"/>
|
<action selector="play:" destination="kYn-Hr-MJq" eventType="touchUpInside" id="lem-QX-Nov"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eNS-GM-32O">
|
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="w5n-dd-01i" userLabel="Pause">
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="180" type="user" id="qyb-TL-L8J"/>
|
<constraint firstAttribute="height" constant="100" type="user" id="heT-S6-HPW"/>
|
||||||
|
<constraint firstAttribute="width" constant="200" type="user" id="zY8-bB-SYS"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
|
||||||
<state key="normal" title="Pause">
|
<state key="normal" title="Pause">
|
||||||
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
|
<state key="disabled">
|
||||||
|
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
</state>
|
||||||
<state key="highlighted">
|
<state key="highlighted">
|
||||||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="pause:" destination="pxQ-Ha-9Mf" eventType="touchUpInside" id="prA-YD-hYl"/>
|
<action selector="pause:" destination="kYn-Hr-MJq" eventType="touchUpInside" id="eZ6-M4-XBq"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="vb0-jC-MBX" firstAttribute="top" secondItem="GxN-0E-u6U" secondAttribute="top" constant="20" symbolic="YES" type="default" id="06u-Jm-lfM"/>
|
<constraint firstAttribute="centerX" secondItem="uVI-yQ-geg" secondAttribute="centerX" type="user" id="2Wc-AU-tx5"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="eNS-GM-32O" secondAttribute="centerX" type="user" id="Sep-Aj-htp"/>
|
<constraint firstItem="8wd-E5-Owx" firstAttribute="leading" secondItem="pac-D3-jCF" secondAttribute="leading" constant="20" symbolic="YES" type="user" id="3rd-sw-9RW"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="vb0-jC-MBX" secondAttribute="centerX" type="user" id="gmk-PR-KdB"/>
|
<constraint firstAttribute="centerX" secondItem="w5n-dd-01i" secondAttribute="centerX" type="user" id="3se-ej-QVc"/>
|
||||||
<constraint firstItem="eNS-GM-32O" firstAttribute="top" secondItem="vb0-jC-MBX" secondAttribute="bottom" constant="8" symbolic="YES" type="default" id="lun-xW-CAi"/>
|
<constraint firstAttribute="trailing" secondItem="8wd-E5-Owx" secondAttribute="trailing" constant="20" symbolic="YES" type="user" id="FyO-Cv-ZON"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="eNS-GM-32O" secondAttribute="bottom" constant="20" symbolic="YES" type="default" id="xWq-oD-d5F"/>
|
<constraint firstItem="uVI-yQ-geg" firstAttribute="top" secondItem="8wd-E5-Owx" secondAttribute="bottom" constant="8" symbolic="YES" type="user" id="Lte-nX-y3p"/>
|
||||||
|
<constraint firstItem="w5n-dd-01i" firstAttribute="top" secondItem="uVI-yQ-geg" secondAttribute="bottom" constant="8" symbolic="YES" type="user" id="Tqh-LF-05e"/>
|
||||||
|
<constraint firstItem="8wd-E5-Owx" firstAttribute="top" secondItem="pac-D3-jCF" secondAttribute="top" constant="20" symbolic="YES" type="user" id="dXW-gd-gnP"/>
|
||||||
|
<constraint firstAttribute="bottom" secondItem="w5n-dd-01i" secondAttribute="bottom" constant="20" symbolic="YES" type="default" id="dbq-X8-9Im"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="GxN-0E-u6U" firstAttribute="leading" secondItem="OMs-0e-qTd" secondAttribute="leading" constant="20" symbolic="YES" type="user" id="H5s-xz-Nfc"/>
|
<constraint firstItem="pac-D3-jCF" firstAttribute="top" secondItem="JOS-rK-Hts" secondAttribute="top" priority="1" constant="20" symbolic="YES" type="user" id="77r-Ci-q9w"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="GxN-0E-u6U" secondAttribute="centerX" type="user" id="dKd-jH-42g"/>
|
<constraint firstItem="pac-D3-jCF" firstAttribute="top" secondItem="JOS-rK-Hts" secondAttribute="top" priority="1" constant="20" symbolic="YES" type="user" id="MGJ-u0-MAG"/>
|
||||||
<constraint firstAttribute="centerY" secondItem="GxN-0E-u6U" secondAttribute="centerY" type="user" id="x24-bd-at0"/>
|
<constraint firstAttribute="centerX" secondItem="pac-D3-jCF" secondAttribute="centerX" type="user" id="Y2t-0q-fAJ"/>
|
||||||
|
<constraint firstItem="pac-D3-jCF" firstAttribute="leading" secondItem="JOS-rK-Hts" secondAttribute="leading" constant="20" symbolic="YES" type="user" id="dPX-1l-W4G"/>
|
||||||
|
<constraint firstAttribute="centerY" secondItem="pac-D3-jCF" secondAttribute="centerY" type="user" id="pxX-Qj-nAV"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
|
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="message_label" destination="8wd-E5-Owx" id="7Xw-cg-3hH"/>
|
||||||
|
<outlet property="pause_button" destination="w5n-dd-01i" id="lHm-u3-mcA"/>
|
||||||
|
<outlet property="play_button" destination="uVI-yQ-geg" id="vI5-ma-lhA"/>
|
||||||
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="3Wk-O5-Z1z" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="25z-hu-OZW" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="423" y="158"/>
|
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<classes>
|
|
||||||
<class className="NSLayoutConstraint" superclassName="NSObject">
|
|
||||||
<source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/>
|
|
||||||
</class>
|
|
||||||
<class className="ViewController" superclassName="UIViewController">
|
|
||||||
<source key="sourceIdentifier" type="project" relativePath="./Classes/ViewController.h"/>
|
|
||||||
<relationships>
|
|
||||||
<relationship kind="action" name="pause:"/>
|
|
||||||
<relationship kind="action" name="play:"/>
|
|
||||||
<relationship kind="outlet" name="label" candidateClass="UILabel"/>
|
|
||||||
</relationships>
|
|
||||||
</class>
|
|
||||||
</classes>
|
|
||||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||||
<simulatedStatusBarMetrics key="statusBar"/>
|
<simulatedStatusBarMetrics key="statusBar"/>
|
||||||
<simulatedOrientationMetrics key="orientation"/>
|
<simulatedOrientationMetrics key="orientation"/>
|
||||||
|
|
Loading…
Reference in a new issue