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

rename mediaItem property since it is ambigous

No functional change
parent e083c6c2
......@@ -348,12 +348,12 @@
_movieViewController = [[VLCMovieViewController alloc] initWithNibName:nil bundle:nil];
if ([mediaObject isKindOfClass:[MLFile class]])
_movieViewController.mediaItem = (MLFile *)mediaObject;
_movieViewController.fileFromMediaLibrary = (MLFile *)mediaObject;
else if ([mediaObject isKindOfClass:[MLAlbumTrack class]])
_movieViewController.mediaItem = [(MLAlbumTrack*)mediaObject files].anyObject;
_movieViewController.fileFromMediaLibrary = [(MLAlbumTrack*)mediaObject files].anyObject;
else if ([mediaObject isKindOfClass:[MLShowEpisode class]])
_movieViewController.mediaItem = [(MLShowEpisode*)mediaObject files].anyObject;
[(MLFile *)_movieViewController.mediaItem setUnread:@(NO)];
_movieViewController.fileFromMediaLibrary = [(MLShowEpisode*)mediaObject files].anyObject;
[(MLFile *)_movieViewController.fileFromMediaLibrary setUnread:@(NO)];
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
......
......@@ -82,7 +82,7 @@
@property (nonatomic, strong) IBOutlet UILabel *trackNameLabel;
@property (nonatomic, strong) IBOutlet UIImageView *artworkImageView;
@property (nonatomic, strong) MLFile *mediaItem;
@property (nonatomic, strong) MLFile *fileFromMediaLibrary;
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, retain) VLCMediaList *mediaList;
@property (nonatomic, readwrite) int itemInMediaListToBePlayedFirst;
......
......@@ -106,11 +106,11 @@
#pragma mark - Managing the media item
- (void)setMediaItem:(id)newMediaItem
- (void)setFileFromMediaLibrary:(id)newFile
{
if (_mediaItem != newMediaItem) {
if (_fileFromMediaLibrary != newFile) {
[self _stopPlayback];
_mediaItem = newMediaItem;
_fileFromMediaLibrary = newFile;
if (_viewAppeared)
[self _startPlayback];
}
......@@ -400,7 +400,7 @@
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (!self.mediaItem && !self.url && !self.mediaList) {
if (!self.fileFromMediaLibrary && !self.url && !self.mediaList) {
[self _stopPlayback];
return;
}
......@@ -413,8 +413,8 @@
self.trackNameLabel.text = self.artistNameLabel.text = self.albumNameLabel.text = @"";
VLCMedia *media;
if (self.mediaItem) {
MLFile *item = self.mediaItem;
if (self.fileFromMediaLibrary) {
MLFile *item = self.fileFromMediaLibrary;
media = [VLCMedia mediaWithURL:[NSURL URLWithString:item.url]];
} else if (!self.mediaList) {
media = [VLCMedia mediaWithURL:self.url];
......@@ -480,7 +480,7 @@
[self.repeatButtonLandscape setImage:[UIImage imageNamed:@"repeat"] forState:UIControlStateNormal];
if (![self _isMediaSuitableForDevice]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DEVICE_TOOSLOW_TITLE", @"") message:[NSString stringWithFormat:NSLocalizedString(@"DEVICE_TOOSLOW", @""), [[UIDevice currentDevice] model], self.mediaItem.title] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_OPEN", @""), nil];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DEVICE_TOOSLOW_TITLE", @"") message:[NSString stringWithFormat:NSLocalizedString(@"DEVICE_TOOSLOW", @""), [[UIDevice currentDevice] model], self.fileFromMediaLibrary.title] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_OPEN", @""), nil];
[alert show];
} else
[self _playNewMedia];
......@@ -491,10 +491,10 @@
- (BOOL)_isMediaSuitableForDevice
{
if (!self.mediaItem)
if (!self.fileFromMediaLibrary)
return YES;
NSUInteger totalNumberOfPixels = [[[self.mediaItem videoTrack] valueForKey:@"width"] doubleValue] * [[[self.mediaItem videoTrack] valueForKey:@"height"] doubleValue];
NSUInteger totalNumberOfPixels = [[[self.fileFromMediaLibrary videoTrack] valueForKey:@"width"] doubleValue] * [[[self.fileFromMediaLibrary videoTrack] valueForKey:@"height"] doubleValue];
NSInteger speedCategory = [[UIDevice currentDevice] speedCategory];
......@@ -526,10 +526,10 @@
{
NSNumber *playbackPositionInTime = @(0);
CGFloat lastPosition = .0;
NSInteger duration = self.mediaItem.duration.intValue;
NSInteger duration = self.fileFromMediaLibrary.duration.intValue;
if (self.mediaItem.lastPosition)
lastPosition = self.mediaItem.lastPosition.floatValue;
if (self.fileFromMediaLibrary.lastPosition)
lastPosition = self.fileFromMediaLibrary.lastPosition.floatValue;
if (lastPosition < .95) {
if (duration != 0)
playbackPositionInTime = @(lastPosition * (duration / 1000.));
......@@ -548,11 +548,11 @@
else
[_listPlayer playMedia:_listPlayer.rootMedia];
if (self.mediaItem) {
if (self.mediaItem.lastAudioTrack.intValue > 0)
_mediaPlayer.currentAudioTrackIndex = self.mediaItem.lastAudioTrack.intValue;
if (self.mediaItem.lastSubtitleTrack.intValue > 0)
_mediaPlayer.currentVideoSubTitleIndex = self.mediaItem.lastSubtitleTrack.intValue;
if (self.fileFromMediaLibrary) {
if (self.fileFromMediaLibrary.lastAudioTrack.intValue > 0)
_mediaPlayer.currentAudioTrackIndex = self.fileFromMediaLibrary.lastAudioTrack.intValue;
if (self.fileFromMediaLibrary.lastSubtitleTrack.intValue > 0)
_mediaPlayer.currentVideoSubTitleIndex = self.fileFromMediaLibrary.lastSubtitleTrack.intValue;
}
self.playbackSpeedSlider.value = [self _playbackSpeed];
......@@ -612,8 +612,8 @@
if (_listPlayer)
_listPlayer = nil;
}
if (_mediaItem)
_mediaItem = nil;
if (_fileFromMediaLibrary)
_fileFromMediaLibrary = nil;
if (_mediaList)
_mediaList = nil;
if (_url)
......@@ -624,9 +624,9 @@
- (void)_saveCurrentState
{
if (self.mediaItem) {
if (self.fileFromMediaLibrary) {
@try {
MLFile *item = self.mediaItem;
MLFile *item = self.fileFromMediaLibrary;
item.lastPosition = @([_mediaPlayer position]);
item.lastAudioTrack = @(_mediaPlayer.currentAudioTrackIndex);
item.lastSubtitleTrack = @(_mediaPlayer.currentVideoSubTitleIndex);
......@@ -862,7 +862,7 @@
* wouldn't see the I-frames when seeking on current mobile devices. This isn't a problem
* within the Simulator, but especially on older ARMv7 devices, it's clearly noticeable. */
[self performSelector:@selector(_setPositionForReal) withObject:nil afterDelay:0.3];
VLCTime *newPosition = [VLCTime timeWithInt:(int)(_positionSlider.value * self.mediaItem.duration.intValue)];
VLCTime *newPosition = [VLCTime timeWithInt:(int)(_positionSlider.value * self.fileFromMediaLibrary.duration.intValue)];
[self.timeDisplay setTitle:newPosition.stringValue forState:UIControlStateNormal];
self.timeDisplay.accessibilityLabel = [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"PLAYBACK_POSITION", @""), newPosition.stringValue];
_positionSet = NO;
......@@ -1362,7 +1362,7 @@
- (void)_updateDisplayedMetadata
{
MLFile *item = self.mediaItem;
MLFile *item = self.fileFromMediaLibrary;
NSString *title;
NSString *artist;
NSString *albumName;
......
......@@ -326,16 +326,16 @@
self.folderIconView.hidden = YES;
}
- (void)_showPositionOfItem:(MLFile *)mediaItem
- (void)_showPositionOfItem:(MLFile *)mediaLibraryFile
{
CGFloat position = mediaItem.lastPosition.floatValue;
CGFloat position = mediaLibraryFile.lastPosition.floatValue;
if (SYSTEM_RUNS_IOS7_OR_LATER) {
CGFloat duration = mediaItem.duration.floatValue;
CGFloat duration = mediaLibraryFile.duration.floatValue;
if (position > .05f && position < .95f && (duration * position - duration) < -60000) {
[(UITextView*)self.mediaIsUnreadView setText:[NSString stringWithFormat:NSLocalizedString(@"LIBRARY_MINUTES_LEFT", @""), [[VLCTime timeWithInt:(duration * position - duration)] minuteStringValue]]];
self.mediaIsUnreadView.hidden = NO;
} else if (mediaItem.unread.intValue) {
} else if (mediaLibraryFile.unread.intValue) {
[(UILabel *)self.mediaIsUnreadView setText:[NSLocalizedString(@"NEW", @"") capitalizedStringWithLocale:[NSLocale currentLocale]]];
self.mediaIsUnreadView.hidden = NO;
} else
......@@ -344,7 +344,7 @@
self.progressView.progress = position;
self.progressView.hidden = ((position < .1f) || (position > .95f)) ? YES : NO;
[self.progressView setNeedsDisplay];
self.mediaIsUnreadView.hidden = !mediaItem.unread.intValue;
self.mediaIsUnreadView.hidden = !mediaLibraryFile.unread.intValue;
}
}
......
......@@ -309,16 +309,16 @@
self.folderIconView.hidden = YES;
}
- (void)_showPositionOfItem:(MLFile *)mediaItem
- (void)_showPositionOfItem:(MLFile *)mediaLibraryFile
{
CGFloat position = mediaItem.lastPosition.floatValue;
CGFloat position = mediaLibraryFile.lastPosition.floatValue;
if (SYSTEM_RUNS_IOS7_OR_LATER) {
CGFloat duration = mediaItem.duration.floatValue;
CGFloat duration = mediaLibraryFile.duration.floatValue;
if (position > .05f && position < .95f && (duration * position - duration) < -60000) {
[(UITextView*)self.mediaIsUnreadView setText:[NSString stringWithFormat:NSLocalizedString(@"LIBRARY_MINUTES_LEFT", @""), [[VLCTime timeWithInt:(duration * position - duration)] minuteStringValue]]];
self.mediaIsUnreadView.hidden = NO;
} else if (mediaItem.unread.intValue) {
} else if (mediaLibraryFile.unread.intValue) {
[(UILabel *)self.mediaIsUnreadView setText:[NSLocalizedString(@"NEW", @"") capitalizedStringWithLocale:[NSLocale currentLocale]]];
self.mediaIsUnreadView.hidden = NO;
} else
......@@ -327,7 +327,7 @@
self.progressIndicator.progress = position;
self.progressIndicator.hidden = ((position < .1f) || (position > .95f)) ? YES : NO;
[self.progressIndicator setNeedsDisplay];
self.mediaIsUnreadView.hidden = !mediaItem.unread.intValue;
self.mediaIsUnreadView.hidden = !mediaLibraryFile.unread.intValue;
}
}
......
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