Skip to content

Commit

Permalink
added testing stuff for streaming video
Browse files Browse the repository at this point in the history
- video view has support for webview
- taken template from philip
- added teststream from apple to check out streaming

Signed-off-by: trailblazr <jollyjinx@planetexpress.local>
  • Loading branch information
trailblazr committed Dec 5, 2012
1 parent 51b81ce commit e09a5c5
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 8 deletions.
12 changes: 12 additions & 0 deletions barfbag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
8F754BC5166EB28C00F74DBB /* VideoStreamsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8F754BC3166EB28C00F74DBB /* VideoStreamsViewController.xib */; };
8F754BC8166EB47200F74DBB /* video.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F754BC6166EB47200F74DBB /* video.png */; };
8F754BC9166EB47200F74DBB /* video@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F754BC7166EB47200F74DBB /* video@2x.png */; };
8F754BCC166EBDEF00F74DBB /* streams.html in Resources */ = {isa = PBXBuildFile; fileRef = 8F754BCB166EBDEF00F74DBB /* streams.html */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -173,6 +174,7 @@
8F754BC3166EB28C00F74DBB /* VideoStreamsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VideoStreamsViewController.xib; sourceTree = "<group>"; };
8F754BC6166EB47200F74DBB /* video.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = video.png; path = images/video.png; sourceTree = SOURCE_ROOT; };
8F754BC7166EB47200F74DBB /* video@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "video@2x.png"; path = "images/video@2x.png"; sourceTree = SOURCE_ROOT; };
8F754BCB166EBDEF00F74DBB /* streams.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = streams.html; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -243,6 +245,7 @@
8F356534166B937C00814549 /* barfbag-Info.plist */,
8F356535166B937C00814549 /* InfoPlist.strings */,
8F356538166B937C00814549 /* main.m */,
8F754BCA166EBDEF00F74DBB /* html */,
8F754AE2166C1E5F00F74DBB /* fonts */,
8F754AC7166B93A800F74DBB /* images */,
);
Expand Down Expand Up @@ -419,6 +422,14 @@
name = Video;
sourceTree = "<group>";
};
8F754BCA166EBDEF00F74DBB /* html */ = {
isa = PBXGroup;
children = (
8F754BCB166EBDEF00F74DBB /* streams.html */,
);
path = html;
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -497,6 +508,7 @@
8F754BC5166EB28C00F74DBB /* VideoStreamsViewController.xib in Resources */,
8F754BC8166EB47200F74DBB /* video.png in Resources */,
8F754BC9166EB47200F74DBB /* video@2x.png in Resources */,
8F754BCC166EBDEF00F74DBB /* streams.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 3 additions & 0 deletions barfbag/GenericViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
- (UIColor*) themeColor;
- (UIColor*) brightColor;
- (UIColor*) darkColor;
- (void) alertWithTag:(NSInteger)tag title:(NSString*)title andMessage:(NSString*)message;
- (void) showActivityIndicator;
- (void) hideActivityIndicator;

@end
38 changes: 34 additions & 4 deletions barfbag/GenericViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@

@implementation GenericViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}

- (void)viewDidLoad
{
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
Expand Down Expand Up @@ -50,4 +48,36 @@ - (UIColor*) darkColor {
return [UIColor colorWithHue:hue saturation:0.5 brightness:0.7 alpha:1.0];
}

- (void) alertWithTag:(NSInteger)tag title:(NSString*)title andMessage:(NSString*)message {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
alert.tag = tag;
[alert show];
[alert release];
}

- (void) showActivityIndicator {
UIActivityIndicatorView *spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];
CGFloat height = self.navigationController.navigationBar.bounds.size.height;
UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, height)] autorelease];
containerView.backgroundColor = kCOLOR_CLEAR;
containerView.opaque = NO;
[containerView addSubview:spinner];
spinner.center = containerView.center;
UIBarButtonItem *item = [[[UIBarButtonItem alloc] initWithCustomView:containerView] autorelease];
[UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.navigationItem.leftBarButtonItem = item;
[spinner startAnimating];
} completion:^(BOOL finished) {
//
}];
}

- (void) hideActivityIndicator {
[UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.navigationItem.leftBarButtonItem = nil;
} completion:^(BOOL finished) {
//
}];
}

@end
6 changes: 4 additions & 2 deletions barfbag/VideoStreamsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#import <UIKit/UIKit.h>
#import "GenericViewController.h"

@interface VideoStreamsViewController : GenericViewController {
@interface VideoStreamsViewController : GenericViewController <UIWebViewDelegate> {


IBOutlet UIWebView *videoStreamsWebView;
}

@property( nonatomic, retain ) UIWebView *videoStreamsWebView;

@end
44 changes: 44 additions & 0 deletions barfbag/VideoStreamsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@

@implementation VideoStreamsViewController

@synthesize videoStreamsWebView;


- (void) dealloc {
self.videoStreamsWebView = nil;
[super dealloc];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
Expand All @@ -18,16 +26,52 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}

#pragma mark - User Actions

- (void) actionRefreshStreamHtml {
self.navigationItem.rightBarButtonItem.enabled = NO;
[videoStreamsWebView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"streams" withExtension:@"html"]]];
}

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.navigationItem.title = @"Videostreams";
self.view.backgroundColor = [self themeColor];
videoStreamsWebView.opaque = NO;
videoStreamsWebView.backgroundColor = kCOLOR_CLEAR;
UIBarButtonItem *item = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(actionRefreshStreamHtml)] autorelease];
self.navigationItem.rightBarButtonItem = item;
[self actionRefreshStreamHtml];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - UIWebViewDelegate

- (void) webViewDidFinishLoad:(UIWebView *)webView {
self.navigationItem.rightBarButtonItem.enabled = YES;
[self hideActivityIndicator];
}

- (void) webViewDidStartLoad:(UIWebView *)webView {
[self showActivityIndicator];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSString *errorString = nil;
if( error ) {
errorString = [NSString stringWithFormat:@"\n\n%@", error];
}
else {
errorString = @"";
}
NSString *message = [NSString stringWithFormat:@"Videostreams could not be loaded successfully.%@", errorString];
[self alertWithTag:0 title:@"Problem" andMessage:message];
}


@end
58 changes: 56 additions & 2 deletions barfbag/VideoStreamsViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUIWebView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
Expand All @@ -33,6 +34,23 @@
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIWebView" id="813315447">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{320, 455}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIDataDetectorTypes">1</int>
<bool key="IBUIDetectsPhoneNumbers">YES</bool>
</object>
</array>
<string key="NSFrame">{{0, 64}, {320, 455}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
Expand Down Expand Up @@ -79,6 +97,22 @@
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">videoStreamsWebView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="813315447"/>
</object>
<int key="connectionID">12</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="813315447"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">11</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
Expand All @@ -91,6 +125,9 @@
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="813315447"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
Expand All @@ -104,6 +141,12 @@
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="813315447"/>
<array class="NSMutableArray" key="children"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -112,12 +155,13 @@
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">3</int>
<int key="maxID">12</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand All @@ -132,6 +176,17 @@
<object class="IBPartialClassDescription">
<string key="className">VideoStreamsViewController</string>
<string key="superclassName">GenericViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">videoStreamsWebView</string>
<string key="NS.object.0">UIWebView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">videoStreamsWebView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">videoStreamsWebView</string>
<string key="candidateClassName">UIWebView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/VideoStreamsViewController.h</string>
Expand All @@ -143,7 +198,6 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
<string key="IBCocoaTouchPluginVersion">1930</string>
</data>
</archive>
32 changes: 32 additions & 0 deletions html/streams.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>

<head>
<title>29C3 Streams for iDevices</title>
<style type="text/css">
body {
background-color:clear;
color:#FFF;
font-family:SourceCodePro-Regular,Arial,SansSerif;
}
h2 {
color:#FFF;
text-align:center;
}
a {
color:white;
}

</style>
</head>

<body>
<h2>Streams from 29C3</h1>
<ul style="list-style-type:square;line-height:1.5em;">
<li><strong>Teststream:</strong><br><a href="http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8">Stream (by Apple Inc.)</a></li>
<li><strong>Saal 1:</strong><br><a href="http://http.28c3.fem-net.de/live/stream_saal1.m3u8">Stream (by FEM)</a></li>
<li><strong>Saal 2:</strong><br><a href="http://http.28c3.fem-net.de/live/stream_saal2.m3u8">Stream (by FEM)</a></li>
<li><strong>Saal 3:</strong><br><a href="http://http.28c3.fem-net.de/live/stream_saal3.m3u8">Stream (by FEM)</a></li>
</ul>

</body>
</html>

0 comments on commit e09a5c5

Please sign in to comment.