AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
10/03/14 05:09 PM (9 years ago)

25$ if you can fix Youtube Playlist Plugin Error

When I'm using the youtube plaits plugin for iPhone when it loads on the iPhone the thumbnail never loads for a video? Does anyone know how to fix this? Thanks
 
Tony @ Buzztouch
buzztouch Evangelist
Profile
Posts: 528
Reg: Mar 05, 2011
Saint Louis, Mi...
24,620
like
10/06/14 10:35 PM (9 years ago)
Hey I don't want your money, but am here to help. Can you shoot me message and we can get this moving forward for you. Tony Buzztouch
 
SheriDee
Code is Art
Profile
Posts: 1094
Reg: Sep 23, 2011
location unknow...
22,840
like
10/07/14 12:20 PM (9 years ago)
For what it is worth the plugin isn't working properly I emailed the developer on this - it seems the images are not appearing now :( This affects a lot of the apps out there - I would email him too -If he doesn't respond please get a hold of Susan since this effects everyone Thanks Sheri
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
10/07/14 07:24 PM (9 years ago)
@Adam has came up with the solution, big thanks to him. Put this in the Das_video_playlist.m change the app delegate name with your project name /* * Copyright 2013 Dasvibes.com, * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice which includes the * name(s) of the copyright holders. It must also retain this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "JSON.h" #import "BT_application.h" #import "BT_strings.h" #import "BT_viewUtilities.h" #import "lebronjames_appDelegate.h" #import "BT_item.h" #import "BT_debugger.h" #import "Das_video_playlist.h" #define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES) @implementation Das_video_playlist @synthesize dataURL, externalURL, didInit; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self; } //viewDidLoad -(void)viewDidLoad{ [BT_debugger showIt:self theMessage:@"viewDidLoad"]; [super viewDidLoad]; arrayVideos = [[NSMutableArray alloc]init]; arrLoadIcon = [[NSMutableArray alloc]init]; self.dataURL = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"DasVideoURL" defaultValue:@""]; NSLog(@"DasVideoURL =%@",self.dataURL); [self readingLocalFile]; [self LoadIcon]; //put code here that adds UI controls to the screen. } //view will appear -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [BT_debugger showIt:self theMessage:@"viewWillAppear"]; } -(void)readingLocalFile{ NSURL *url =[NSURL URLWithString:self.dataURL]; NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]; connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; //notice how delegate set to self object } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ mutableData=[[NSMutableData alloc]init]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ [mutableData appendData:data]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection{ NSString *strResponse=[[NSString alloc]initWithData:mutableData encoding:NSUTF8StringEncoding]; NSData *data=[strResponse dataUsingEncoding:NSUTF8StringEncoding]; NSMutableData *xmlURL=[[NSMutableData alloc]initWithData:data]; NSXMLParser * parser = [[NSXMLParser alloc] initWithData:xmlURL]; [parser setDelegate:self]; [parser parse]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{ NSLog(@"didFailWithError"); } - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ currentElement = [elementName copy]; if ([currentElement isEqualToString:@"entry"]) { isSelect = NO; itemDict = [[NSMutableDictionary alloc] init]; albumTitle = [[NSMutableString alloc]init]; } if ([currentElement isEqualToString:@"media:thumbnail"] && !isSelect) { isSelect = YES; NSMutableDictionary *dictthumbnail= [[NSMutableDictionary alloc] init]; albumImg = [[NSMutableString alloc]init]; [dictthumbnail setObject:[attributeDict valueForKey:@"url"] forKey:@"media:thumbnail"]; albumImg = [dictthumbnail valueForKey:@"media:thumbnail"]; [itemDict setValue:albumImg forKey:@"MediaThumbNailImg"]; } if ([currentElement isEqualToString:@"media:player"]) { NSMutableDictionary *dictvideoLink= [[NSMutableDictionary alloc] init]; albumVideo = [[NSMutableString alloc] init]; [dictvideoLink setObject:[attributeDict valueForKey:@"url"] forKey:@"media:player"]; albumVideo = [dictvideoLink valueForKey:@"media:player"]; [itemDict setValue:albumVideo forKey:@"MediaVideoLink"]; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ if ([currentElement isEqualToString:@"media:title"]) { [albumTitle appendString:string]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if ([elementName isEqual:@"media:title"]) { [itemDict setValue:albumTitle forKey:@"MediaTitle"]; } if ([elementName isEqual:@"entry"]) { [arrayVideos addObject:itemDict]; } } - (void)parserDidEndDocument:(NSXMLParser *)parser { for(int i=0; i<[arrayVideos count]; i++) { [arrLoadIcon addObject:@""]; } [videoTableView reloadData]; [loadingView removeFromSuperview]; [activityViewCommon removeFromSuperview]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [arrayVideos count]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 90; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier =@"cell"; Das_video_playlistCustomView *cell = (Das_video_playlistCustomView *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"Das_video_playlistCustomView" owner:self options:nil]; cell = customCell; UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ if (UIInterfaceOrientationIsLandscape(interfaceOrientation)){ [cell.albumNameLbl setFrame:CGRectMake(128, 12, 800, 66)]; } else{ [cell.albumNameLbl setFrame:CGRectMake(128, 12, 650, 66)]; } } else{ if (UIInterfaceOrientationIsLandscape(interfaceOrientation)){ if (IS_IPHONE5){ [cell.albumNameLbl setFrame:CGRectMake(128, 12, 400, 66)]; } else{ [cell.albumNameLbl setFrame:CGRectMake(128, 12, 340, 66)]; } } } } CGRect frame; frame.size.width=120; frame.size.height=90; frame.origin.x=0; frame.origin.y=0; if([[arrLoadIcon objectAtIndex:indexPath.row] isEqual:@""]) { Das_video_AsyncImageView* asyncImage = [[Das_video_AsyncImageView alloc] initWithFrame:frame]; NSString *albumCoverArtAsync = [[arrayVideos objectAtIndex:indexPath.row] valueForKey:@"MediaThumbNailImg"]; NSURL* url = [[NSURL alloc] initWithString:albumCoverArtAsync]; [asyncImage loadImageFromURL:url]; [cell.iconImage addSubview:asyncImage]; [arrLoadIcon replaceObjectAtIndex:indexPath.row withObject:asyncImage]; } else { [cell.iconImage addSubview:[arrLoadIcon objectAtIndex:indexPath.row]]; } [cell setAlbumName:[[arrayVideos objectAtIndex:indexPath.row] valueForKey:@"MediaTitle"]]; cell.selectionStyle = NO; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSString *urlValue = [[arrayVideos objectAtIndex:indexPath.row] valueForKey:@"MediaVideoLink"]; NSDictionary *videos = [Das_HCYoutubeParser h264videosWithYoutubeURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",urlValue]]]; NSLog(@"THE URL iS =%@",videos); // Presents a MoviePlayerController with the youtube quality medium MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[videos objectForKey:@"hd720"]]]; [mp.moviePlayer setFullscreen:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:mp]; [self presentMoviePlayerViewControllerAnimated:mp]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",urlValue]]; // To get a thumbnail for an image there is now a async method for that [Das_HCYoutubeParser thumbnailForYoutubeURL:url thumbnailSize:YouTubeThumbnailDefaultHighQuality completeBlock:^(UIImage *image, NSError *error) { if (!error) { } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil]; [alert show]; } }]; } - (void) moviePlayBackDidFinish:(NSNotification*)notification { MPMoviePlayerController *player = [notification object]; [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player]; if ([player respondsToSelector:@selector(setFullscreen:animated:)]) { [player.view removeFromSuperview]; } } -(void)LoadIcon { UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ if (UIInterfaceOrientationIsLandscape(interfaceOrientation)){ loadingView = [[UIView alloc] initWithFrame:CGRectMake(480, 350, 80, 80)]; }else{ loadingView = [[UIView alloc] initWithFrame:CGRectMake(350, 480, 80, 80)]; } [loadingView setBackgroundColor:[UIColor darkGrayColor]]; [loadingView.layer setMasksToBounds:YES]; [loadingView.layer setCornerRadius:10.0]; activityViewCommon = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; [activityViewCommon setFrame:CGRectMake(21, 21, 37, 37)]; [activityViewCommon setHidesWhenStopped:YES]; [activityViewCommon startAnimating]; [loadingView addSubview:activityViewCommon]; [self.view addSubview:loadingView]; } else{ loadingView = [[UIView alloc] initWithFrame:CGRectMake(120, 180, 80, 80)]; [loadingView setBackgroundColor:[UIColor darkGrayColor]]; [loadingView.layer setMasksToBounds:YES]; [loadingView.layer setCornerRadius:10.0]; activityViewCommon = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; [activityViewCommon setFrame:CGRectMake(21, 21, 37, 37)]; [activityViewCommon setHidesWhenStopped:YES]; [activityViewCommon startAnimating]; [loadingView addSubview:activityViewCommon]; [self.view addSubview:loadingView]; } } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ [videoTableView reloadData]; } @end
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.