大佬教程收集整理的这篇文章主要介绍了如何在iOS应用程序中播放m3u音频流,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想通过播放,暂停,音量控制来播放@“http://xx.xxxxxxx.com/8111/radio.m3u”并能够播放背景功能/多任务处理.
到目前为止,我已经@L_772_3@了AVFoundation,Mediaplayer和AudioToolBox框架.我已经为xib@L_772_3@了播放,暂停和滑块对象.
ViewController.h @interface ViewController : UIViewController @property (strong,nonatomiC) MPMoviePlayerController *myPlayer; @property (weak,nonatomiC) IBOutlet UiSlider *myslider; - (IBACtion)playButtonPressed; - (IBACtion)myslider:(id)sender; @end ViewController.m #import "ViewController.h" #import <MediaPlayer/MediaPlayer.h> @interface ViewController () { UiSlider *volumeSlider; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; UIBACkgroundTaskIdentifier newTaskId = UIBACkgroundTaskInvalid; newTaskId = [[UIApplication sharedApplication] beginBACkgroundTaskWithExpirationHandler:NULL]; } - (IBACtion)playButtonPressed; { NSString *urlAddress = @"http://xxxxxxx.com/8111/listen.m3u"; NSURL *url = [NSURL URLWithString:urlAddress]; MPMoviePlayerController *player = [[MPMoviePlayerController alloc]initWithContentURL:url]; player.moviesourceType = MPMoviesourceTypeStreaming; [player prepareToPlay]; self.myPlayer = player; [self.view addSubview:self.myPlayer.view]; [self.myPlayer play]; } - (IBACtion)stopButtonPressed; { [self.myPlayer stop]; } - (IBACtion)myslider:(id)sender { MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame: CGRectMake(10,10,200,40)]; [volumeSlider addSubview:volumeView]; [volumeView sizeToFit]; }
以上是大佬教程为你收集整理的如何在iOS应用程序中播放m3u音频流全部内容,希望文章能够帮你解决如何在iOS应用程序中播放m3u音频流所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。