0

any one help me i am not using MPMoviePlayerController jest i am tack in UItableView in Four cells

#import "VSChannelListViewController.h"
#import "VSPlayerViewController.h"

@interface Channel : NSObject {
    NSString *_name;
    NSString *_urlAddress;
    NSString *_description;
    NSDictionary *_options;
}

@property (nonatomic, readonly) NSString *name;
@property (nonatomic, readonly) NSString *urlAddress;
@property (nonatomic, readonly) NSString *description;
@property (nonatomic, readonly) NSDictionary *options;

+ (id)channelWithName:(NSString *)name addr:(NSString *)addr description:(NSString *)description options:(NSDictionary *)options;
- (id)initWithName:(NSString *)name addr:(NSString *)addr description:(NSString *)description options:(NSDictionary *)options;

@end

@implementation Channel

@synthesize name = _name;
@synthesize urlAddress = _urlAddress;
@synthesize description = _description;
@synthesize options = _options;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = @"Channel List";
        _channelList = [[NSMutableArray array] retain];

       Channel *c1 = [Channel channelWithName:@"TEST" addr:@"rtsp://202.65.154.103:1935/live/text.stream" description:@"justin reporter" options:[NSDictionary dictionaryWithObject:VSDECODER_OPT_VALUE_RTSP_TRANSPORT_TCP forKey:VSDECODER_OPT_KEY_RTSP_TRANSPORT]];
        [_channelList addObject:c1];

        Channel *c2 = [Channel channelWithName:@"Cartoon TV" addr:@"rtsp://ws2.gpom.com/cartoon" description:@"justin reporter Pavan" options:[NSDictionary dictionaryWithObject:VSDECODER_OPT_VALUE_RTSP_TRANSPORT_TCP forKey:VSDECODER_OPT_KEY_RTSP_TRANSPORT]];
        [_channelList addObject:c2];

        Channel *c3 = [Channel channelWithName:@"Sky-news" addr:@"rtsp://202.65.154.103:1935/live/text.stream" description:@"justin reporter Alapati" options:[NSDictionary dictionaryWithObject:VSDECODER_OPT_VALUE_RTSP_TRANSPORT_TCP forKey:VSDECODER_OPT_KEY_RTSP_TRANSPORT]];
        [_channelList addObject:c3];

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onVSPlayerStateChanged:) name:kVSPlayerStateChangedNotification object:nil];
    }
      return self;
;
}

and then using tableView methods

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [_channelList count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellId = @"CellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId] autorelease];

        UIView *topLine = [[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)] autorelease];
        topLine.backgroundColor = [UIColor colorWithRed:1.1 green:1.1 blue:1.11 alpha:0.5];
        [cell.contentView addSubview:topLine];

        UIView *bottomLine = [[[UIView alloc] initWithFrame:CGRectMake(0.0f, 63.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)] autorelease];
        bottomLine.backgroundColor =[UIColor colorWithRed:0.78 green:0.78 blue:0.79 alpha:0.5];
        [cell.contentView addSubview:bottomLine];

        cell.selectionStyle = UITableViewCellSelectionStyleGray;
        cell.textLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:18];
        cell.detailTextLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:16];
    }

    Channel *channel = [_channelList objectAtIndex:indexPath.row];
    cell.textLabel.text = [channel name];
    cell.detailTextLabel.text = [channel description];

    return cell;
}

- (void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath {
    cell.backgroundColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.95 alpha:1.0];
}

and then using didSelectRowAtIndexPath in

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    Channel *channel = [_channelList objectAtIndex:indexPath.row];
    NSString *urlString = [channel urlAddress];
    NSDictionary *options = [channel options];

    VSPlayerViewController *playerVc = [[[VSPlayerViewController alloc] initWithURL:[NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] decoderOptions:options] autorelease];
    playerVc.barTitle = [channel name];
    playerVc.statusBarHidden = YES;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
    if ([[[UIDevice currentDevice] systemVersion] compare:@"6.0" options:NSNumericSearch] != NSOrderedAscending) {
        //running on iOS 6.0 or higher
        [self.navigationController presentViewController:playerVc animated:YES completion:NULL];
    } else {
        //running on iOS 5.x
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000
        [self.navigationController presentModalViewController:playerVc animated:YES];
#endif
    }
#else
    [self.navigationController presentModalViewController:playerVc animated:YES];
#endif

}

when click TableViewCell it open and play video portrait mode using RTSP protocal but My requirement is When click TableViewCell it open and play video in landscape mode with out Mobile Rotation Please give any idea Thanks in advanced

Pavan Alapati
  • 317
  • 1
  • 5
  • 17

1 Answers1

0

In VSPlayerViewController class, viewWillAppear/viewDidLoad method:

//rotate rect
self.view.transform = CGAffineTransformMakeRotation(M_PI_2); 

Hope this helps.

Mrunal
  • 13,982
  • 6
  • 52
  • 96
  • please look my code once VSplayerViewController in class i am not place ViewDidLoad method Please help me – Pavan Alapati Jun 13 '14 at 07:13
  • Try adding that line of code in VSPlayerViewController.mm file ViewDidLoad method. The code you have added is from file Channel.mm – Mrunal Jun 13 '14 at 07:20
  • k i placed like this in implementation Channel - (void)viewDidLoad { [super viewDidLoad]; self.view.transform = CGAffineTransformMakeRotation(M_PI_2) } but i got error is Property View not found on object of type Channel – Pavan Alapati Jun 13 '14 at 07:31
  • i don't have VSPlayerViewController.mm file – Pavan Alapati Jun 13 '14 at 07:35
  • Then write this code wherever VSPlayerViewController class has been implemented. In that section, there would be viewDidLoad method. – Mrunal Jun 13 '14 at 07:36
  • k i will try but please look once my code any then Please tell me where i placed your line in my code – Pavan Alapati Jun 13 '14 at 07:39
  • already up-vote your ans small problem when video play portrait mode it have Done button but when Video Play landscape mode it's not display So Please help me how to back to TableView – Pavan Alapati Jun 13 '14 at 09:51