Commit c2096080 authored by Felix Paul Kühne's avatar Felix Paul Kühne

iOS-Example: add sample code to debug SPU options

(cherry picked from commit d981ce9e)
parent ce2c7d14
......@@ -37,6 +37,17 @@
@implementation VDLAppDelegate
+ (void)initialize
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = @{kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue,
kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue,
kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue,
kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaultValue};
[defaults registerDefaults:appDefaults];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
......
......@@ -26,6 +26,15 @@
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#define kVLCSettingSubtitlesFont @"quartztext-font"
#define kVLCSettingSubtitlesFontDefaultValue @"HelveticaNeue"
#define kVLCSettingSubtitlesFontSize @"quartztext-rel-fontsize"
#define kVLCSettingSubtitlesFontSizeDefaultValue @"16"
#define kVLCSettingSubtitlesBoldFont @"quartztext-bold"
#define kVLCSettingSubtitlesBoldFontDefaultValue @NO
#define kVLCSettingSubtitlesFontColor @"quartztext-color"
#define kVLCSettingSubtitlesFontColorDefaultValue @"16777215"
@interface VDLPlaybackViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIView *movieView;
......
......@@ -111,6 +111,9 @@
_mediaplayer.delegate = self;
_mediaplayer.drawable = self.movieView;
/* enable debug logging from libvlc here */
_mediaplayer.libraryInstance.debugLogging = YES;
/* listen for notifications from the player */
[_mediaplayer addObserver:self forKeyPath:@"time" options:0 context:nil];
[_mediaplayer addObserver:self forKeyPath:@"remainingTime" options:0 context:nil];
......@@ -195,6 +198,14 @@
{
VLCMediaPlayerState currentState = _mediaplayer.state;
if (currentState == VLCMediaPlayerStateBuffering) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[_mediaplayer performSelector:@selector(setTextRendererFont:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFont]];
[_mediaplayer performSelector:@selector(setTextRendererFontSize:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontSize]];
[_mediaplayer performSelector:@selector(setTextRendererFontColor:) withObject:[defaults objectForKey:kVLCSettingSubtitlesFontColor]];
[_mediaplayer performSelector:@selector(setTextRendererFontForceBold:) withObject:[defaults objectForKey:kVLCSettingSubtitlesBoldFont]];
}
/* distruct view controller on error */
if (currentState == VLCMediaPlayerStateError)
[self performSelector:@selector(closePlayback:) withObject:nil afterDelay:2.];
......
......@@ -33,7 +33,7 @@
- (IBAction)startPlayback:(id)sender
{
VDLAppDelegate *appDelegate = (VDLAppDelegate *)[UIApplication sharedApplication].delegate;
[appDelegate playStreamFromURL:[NSURL URLWithString:@"http://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4"]];
[appDelegate playStreamFromURL:[NSURL URLWithString:@"file:///Users/fkuehne/Downloads/Alice.m4v"]];
}
- (void)didReceiveMemoryWarning
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment