简述
AVPlay既可以用来播放音频也可以用来播放视频,AVPlay在播放音频方面可以直接用来播放网络上的音频。在使用AVPlay的时候我们需要引入头文件
#import<AVFoundation/AVFoundation.h>
AVPlayer —— 音频播放
1. 首先导入头文件 #import<AVFoundation/AVFoundation.h>以及声明属性player和播放按钮playbutton
#import <AVFoundation/AVFoundation.h>
@property (nonatomic,strong) AVPlayer *player;
@property (nonatomic, retain) UIButton *playButton;
2.播放按钮的设置
代码实现
// 播放的button
self.playButton = [UIButton buttonWithType:UIButtonTypeSystem];
self.playButton