...
Code Block |
---|
// // MediaPlayerAdapter.m // SpringStreams // // Created by Frank Kammann on 26.08.11. // Copyright 2011 spring GmbH & Co. KG. All rights reserved. // #import <MediaPlayer/MediaPlayer.h> #import <UIKit/UIKit.h> #import "SpringStreams.h" @class MediaPlayerMeta; @implementation MediaPlayerAdapter MPMoviePlayerController *controller; NSObject<Meta> *meta; - (id)adapter:(MPMoviePlayerController *)player { self = [super init:player]; if (self) { meta = [[MediaPlayerMeta alloc] meta:player]; } return self; } - (NSObject<Meta>*) getMeta { return meta; } - (int) getPosition { int position = (int)round([controller currentPlaybackTime]); // in initialize phase in controller this value is set to -2^31 if(position < 0) position = 0; return position; } - (int) getDuration { return (int)round([controller duration]); } - (int) getWidth { return controller.view.bounds.size.width; } - (int) getHeight { return controller.view.bounds.size.height; } - (void)dealloc { [meta release]; [super dealloc]; } @end @implementation MediaPlayerMeta MPMoviePlayerController *controller; - (id) meta:(MPMoviePlayerController *)player { self = [super init]; if (self) { if(player == nil) @throw [NSException exceptionWithName:@"IllegalArgumentException" reason:@"player may not be null" userInfo:nil]; controller = player; } return self; } - (NSString*) getPlayerName { return @"MediaPlayer"; } - (NSString*) getPlayerVersion { return [UIDevice currentDevice].systemVersion; } - (int) getScreenWidth { CGRect screenRect = [[UIScreen mainScreen] bounds]; return screenRect.size.width; } - (int) getScreenHeight { CGRect screenRect = [[UIScreen mainScreen] bounds]; return screenRect.size.height; } @end |
Implementation of the URL Scheme in iOS
Generally for spring measuring purpose, only some modifications need to be applied in your App, if a Panel App is used in your market.
(This blog may assist your implementation):
Register the URL Scheme accordingly.
In order to register your URL Scheme into your iOS App, you need to edit the Info.plist
file under the "Supporting Files" in your project folder, two ways:
you can edit it in any editor, if you do so, please insert the following code:
Code Block <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>***</string> //please change *** to your URL name, not so important <key>CFBundleURLSchemes</key> <array> <string>***</string> //very important, please replace </array> </dict> </array>
Or you can edit this in xcode, add an item into
Info.plist
, named "URL types", expand "Item 0" under "URL types", and add two items: "URL identifier", "URL Schemes".For "URL identifier", assign your identifier, and for "URL Schemes", add a new item within it named "Item0", REGISTER A UNIQUE URL SCHEME FOR YOUR APP, VERY IMPORTANT!
It should be like the following: