Skip to content

Instantly share code, notes, and snippets.

View RameshAran's full-sized avatar

Arangott Ramesh Chandran RameshAran

View GitHub Profile
- (void)printQualityLevel
{
NSLog(@"current playback quality:- ");
switch (self.mYTPlayerView.playbackQuality) {
case kYTPlaybackQualitySmall:
NSLog(@"kYTPlaybackQualitySmall");
break;
case kYTPlaybackQualityMedium:
NSLog(@"kYTPlaybackQualityMedium");
break;
#pragma ---
#pragma YTPlayerView Delegates
- (void)playerViewDidBecomeReady:(YTPlayerView *)playerView
{
NSLog(@"YTPlayerView : playerViewDidBecomeReady");
NSArray *qualityLevels = [self.mYTPlayerView availableQualityLevels];
NSLog(@"quality levels available:- %@", qualityLevels);
}
- (IBAction)pause:(id)sender
{
if(self.mYTPlayerView.playerState == kYTPlayerStatePlaying){
[self.mYTPlayerView pauseVideo];
}
}
- (IBAction)stop:(id)sender
{
if(self.mYTPlayerView.playerState == kYTPlayerStatePlaying || self.mYTPlayerView.playerState == kYTPlayerStatePaused){
- (IBAction)play:(id)sender
{
if(self.mYTPlayerView.playerState != kYTPlayerStatePlaying){
[self.mYTPlayerView playVideo];
}
}
NSDictionary *playerVars = @{@"playsinline" : @1,};
if([self.mYTPlayerView loadWithVideoId:@"M7lc1UVf-VE" playerVars:playerVars])
{
self.mYTPlayerView.delegate = self;
}
else
{
NSLog(@"failed loading player");
}
- (void)showActionSheetWithTwoButtons {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"ActionSheet!"
message:@"This is an ActionSheet."
preferredStyle:UIAlertControllerStyleActionSheet];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
- (void)showAlertWithTwoTextField {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu"
message:@"Select a menu"
preferredStyle:UIAlertControllerStyleAlert];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"User name";
textField.textColor = [UIColor whiteColor];
- (void)showAlertWithTextField {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu"
message:@"Select a menu"
preferredStyle:UIAlertControllerStyleAlert];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
//Customize the textField
textField.placeholder = @"User name";
textField.textColor = [UIColor whiteColor];
- (void)showAlertWithTwoButtons {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Alert!"
message:@"This is an Alert."
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
- (void)showSimpleAlert {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Alert!"
message:@"This is an Alert."
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);