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

vpc: add APIs to detect an active playback session and if it is audio-only

parent 0476d0df
......@@ -52,7 +52,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@property (nonatomic, retain) VLCMediaList *mediaList;
@property (nonatomic, readwrite) int itemInMediaListToBePlayedFirst;
/* returns nil if currenlty plaing item is not a MLFile, e.g. a url */
/* returns nil if currently playing item is not a MLFile, e.g. a url */
@property (nonatomic, strong, readonly) MLFile *currentlyPlayingMediaFile;
@property (nonatomic, weak) id<VLCPlaybackControllerDelegate> delegate;
......@@ -64,6 +64,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@property (nonatomic, readwrite) float playbackRate;
@property (nonatomic, readonly) BOOL currentMediaHasChapters;
@property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom;
@property (nonatomic, readonly) BOOL activePlaybackSession;
@property (nonatomic, readonly) BOOL audioOnlyPlaybackSession;
+ (VLCPlaybackController *)sharedInstance;
......
......@@ -23,6 +23,8 @@
#import <MediaPlayer/MediaPlayer.h>
#import "VLCThumbnailsCache.h"
#import <WatchKit/WatchKit.h>
#import "VLCAppDelegate.h"
#import "VLCPlaylistViewController.h"
@interface VLCPlaybackController () <AVAudioSessionDelegate, VLCMediaPlayerDelegate, VLCMediaDelegate>
{
......@@ -332,6 +334,7 @@
_mediaPlayer.position = lastPosition;
[self subscribeRemoteCommands];
[[(VLCAppDelegate *)[UIApplication sharedApplication].delegate playlistViewController] displayMiniPlaybackViewIfNeeded];
_playerIsSetup = YES;
}
......@@ -451,6 +454,16 @@
return [[_mediaPlayer audioTrackIndexes] count] > 2 || [[_mediaPlayer videoSubTitlesIndexes] count] > 1;
}
- (BOOL)activePlaybackSession
{
return _mediaPlayer != nil;
}
- (BOOL)audioOnlyPlaybackSession
{
return _mediaIsAudioOnly;
}
- (float)playbackRate
{
float f_rate = _mediaPlayer.rate;
......@@ -594,6 +607,9 @@
- (void)setVideoOutputView:(UIView *)videoOutputView
{
if (videoOutputView) {
if ([_actualVideoOutputView superview] != nil)
[_actualVideoOutputView removeFromSuperview];
_mediaPlayer.currentVideoTrackIndex = 0;
_actualVideoOutputView.frame = (CGRect){CGPointZero, videoOutputView.frame.size};
[_actualVideoOutputView layoutSubviews];
......
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