新疆框架
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// CQAudioPlayManager.h
|
||||
// EscortProject
|
||||
//
|
||||
// Created by 仁康信息 on 2023/12/5.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CQAudioPlayManager : NSObject
|
||||
|
||||
+ (AVPlayer *)initWhithUrl:(NSURL *)avUrl;
|
||||
|
||||
//开始播放
|
||||
+ (void)avPlayIngAction:(AVPlayer *)avPlay;
|
||||
|
||||
//暂停播放
|
||||
+ (void)avPauseAction:(AVPlayer *)avPlay;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// CQAudioPlayManager.m
|
||||
// EscortProject
|
||||
//
|
||||
// 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
|
||||
Reference in New Issue
Block a user