AV Player.

View.m

#pragma mark -  AV player launch
                 
                 dispatch_async(dispatch_get_main_queue(), ^(void){
                     
                     AVAsset *asset = [AVURLAsset URLAssetWithURL:Song_url options:nil];
                     playerItem = [AVPlayerItem playerItemWithAsset:asset];
                     
                     [gp.aPlayer_main replaceCurrentItemWithPlayerItem:playerItem];
                     
                     self.timer =[NSTimer scheduledTimerWithTimeInterval:1.0 target:self    selector:@selector(updateSlider) userInfo:nil repeats:YES];
                     self.currentTimeSlider.maximumValue=CMTimeGetSeconds(asset.duration);
                     [self.currentTimeSlider addTarget:self action:@selector(sliding:) forControlEvents:UIControlEventValueChanged];
                     //self.currentTimeSlider.minimumValue = 0.0;
                     self.currentTimeSlider.continuous = YES;
                     
                     lbl_songStartTime.text = [NSString stringWithFormat:@"0:00"];
                     lbl_songLastTime.text=[NSString stringWithFormat:@"%@",[self timeFormat:CMTimeGetSeconds(asset.duration)]];
                     
                     [self.btn_play_p setBackgroundImage:[UIImage imageNamed:@"ic_pause_white.png"]forState:UIControlStateNormal];
                     

                     

Comments