Latest 0.1.3
Homepage https://github.com/silence0201/MediaMetaManager
License MIT
Platforms ios 7.0, requires ARC
Frameworks AVFoundation
Authors

Language
License

对多媒体的元数据获取进行简单封装

导入

将项目中MetaManager文件夹拖到项目里

或者使用Pod安装

pod 'MediaMetaManager', '~> 0.1.0'  

使用

  1. 导入头文件

    #import "MediaMetaManager.h"
  2. 初始化

    NSURL *url = [[NSBundle mainBundle] URLForResource:@"Demo" withExtension:@"m4a"] ;
    SIMediaItem *mediaItem = [[SIMediaItem alloc]initWithURL:url] ;
  3. 准备元数据

    [mediaItem prepareWithCompletionHandler:^(BOOL complete) {
        if (complete) {
            NSLog(@"%@",mediaItem.dictionaryRepresentation) ;
            NSLog(@"%@",mediaItem.metadata.dictionaryRepresentation) ;
        }
    }] ;
  4. 可以获取的数据如下

    SIMediaItem

    @property (strong, readonly) NSString *filename;
    @property (strong, readonly) NSString *filetype;
    @property (strong, readonly) SIMetadata *metadata;
    @property (readonly, getter = isEditable) BOOL editable;

    SIMetadata

    @property (copy) NSString *name;
    @property (copy) NSString *artist;
    @property (copy) NSString *albumArtist;
    @property (copy) NSString *album;
    @property (copy) NSString *grouping;
    @property (copy) NSString *composer;
    @property (copy) NSString *comments;
    @property (strong) UIImage *artwork;
    @property (strong) SIGenre *genre;
    
    @property NSString *year;
    @property NSNumber *bpm;
    @property NSNumber *trackNumber;
    @property NSNumber *trackCount;
    @property NSNumber *discNumber;
    @property NSNumber *discCount;
  5. 保存修改

    mediaItem.metadata.name = @"TT" ;
    [mediaItem saveChangeWithCompletionHandler:^(BOOL complete) {
        if (complete) {
            NSLog(@"修改成功") ;
        }
    }] ;

MediaMetaManager

MediaMetaManager is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MediaMetaManager",
    "version": "0.1.3",
    "summary": "MediaMetaManager.",
    "description": "An easy get media meta data",
    "homepage": "https://github.com/silence0201/MediaMetaManager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Silence": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/silence0201/MediaMetaManager.git",
        "tag": "0.1.3"
    },
    "source_files": [
        "MetaManager",
        "MetaManager/**/*.{h,m}"
    ],
    "exclude_files": "MetaManager/Exclude",
    "frameworks": "AVFoundation",
    "requires_arc": true
}

Pin It on Pinterest

Share This