Streaming Measurement in iOS
This chapter describes the basic use of the sensor for the measurement of streaming content.
Properties of the Library
Property | Default | Description |
---|---|---|
tracking | true | If this property is set to |
offlineMode | false | If this property is set to |
debug | false | If the value is set to true , the debug messages are issued by the library |
timeout | 10 | Timeout Setting for the HTTP-Request |
Lifecycle of the Measurement
...
Note |
---|
The site name and application name is specified by the operator of the measurement system. |
From this point on, the method getInstance
must be used .
Code Block | ||||
---|---|---|---|---|
| ||||
KMA_SpringStreams *spring = [KMA_SpringStreams getInstance]; |
...
Implementation of the Adapter
...
Code Block | ||||
---|---|---|---|---|
| ||||
@protocol@interface KMA_Player_Meta <NSObject> @required -(NSString*) getPlayerName; -(NSString*) getPlayerVersion; -(int) getScreenWidth; -(int) getScreenHeight; @end @interface StreamAdapter : NSObject { } - (id) init:(NSObject *)stream; -(NSObject<Meta> : NSObject<NSCoding, NSCopying> { } @property (retain,readwrite) NSString *playername; @property (retain,readwrite) NSString *playerversion; @property (assign,readwrite) int screenwidth; @property (assign,readwrite) int screenheight; @end @protocol KMA_StreamAdapter @required -(KMA_Player_Meta*) getMeta; -(int) getPosition; -(int) getDuration; -(int) getWidth; -(int) getHeight; @end |
...
|
Beginning of the Measurement
This chapter explains step by step how a streaming content is transferred to the library for the measurement.
Info |
---|
In the library an adapter for class AVPlayerViewController from the AVKit ramework is settled. The source code for this implementation can be found in Appendix Anhang A and in the library. |
The following code block shows an example for the use of the library.
...
Then an NSDictionary is generated in order to formulate more detailed information about the stream. Therefore the attribute stream must always be specified
Info |
---|
The attribute |
...
Info |
---|
A stream is measured as long as the application is in the foreground. When the application goes into the background, the current status is transmitted to the measurement system and the measurement stops. If the stream should be measured again, when the application will come back to the foreground, the method |
...
End of the Measurement
After the measurement of a stream has been started, this stream is measured by the sensor. The measurement can be stopped by calling the method stop
on the stream object. All measurements will be automatically stopped by the library, when the application goes into the background.
...
Info |
---|
If the stream should be measured again, when the application comes to the foreground or after the method |
...
Foreground- and Background Actions
Info |
---|
Once the application is in the background all measurements in the library are stopped, i.e. when the application goes to the foreground, the measurement on a stream must be restarted. |
...
Code Block | ||||
---|---|---|---|---|
| ||||
... [[KMA_SpringStreams getInstance] unload]; |
...
Appendix A
Anchor | ||||
---|---|---|---|---|
|
...
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:
How to use the different Files in the Library Package
File | Description |
---|---|
spring-appsensor-device.a | This is the version that has been compiled with ARM support and which is intended for execution on iOS devices |
spring-appsensor-simulator.a | This is the version that has been compiled with x86 support and which is intended for execution on iOS simulator |
spring-appsensor-fat.a | This is a combined version of the two libraries above, which can be executed on both, iOS devices and iOS simulator because it contains code for ARM and x86 execution. This file is called "fat" as it is roughly double the size (because it combines both versions). |
Note |
---|
If size does not matter for the app, the "fat" version is the carefree option to be used for execution on simulator and real devices. |
Include Page Tutorial on how to import KMA measurement Objective-C library into Swift project Tutorial on how to import KMA measurement Objective-C library into Swift project