35 lines
622 B
Objective-C
35 lines
622 B
Objective-C
//
|
|
// CQAudioPlayManager.m
|
|
// XinjiangProject
|
|
//
|
|
// Created by 仁康信息 on 2023/12/5.
|
|
//
|
|
|
|
#import "CQAudioPlayManager.h"
|
|
|
|
@implementation CQAudioPlayManager
|
|
|
|
+ (AVPlayer *)initWhithUrl:(NSURL *)avUrl {
|
|
|
|
|
|
AVPlayerItem * item = [AVPlayerItem playerItemWithURL:avUrl];// 2.创建AVPlayerItem
|
|
AVPlayer * avTools = [AVPlayer playerWithPlayerItem:item];
|
|
avTools= [AVPlayer playerWithURL:avUrl];
|
|
return avTools;
|
|
|
|
}
|
|
|
|
//开始播放
|
|
+ (void)avPlayIngAction:(AVPlayer *)avPlay {
|
|
|
|
[avPlay play];
|
|
}
|
|
|
|
//暂停播放
|
|
+ (void)avPauseAction:(AVPlayer *)avPlay {
|
|
|
|
[avPlay pause];
|
|
}
|
|
|
|
@end
|