Skip to content

3.17.0

Compare
Choose a tag to compare
@chausov chausov released this 23 Nov 15:29
· 7 commits to develop since this release

Changes from 3.16.0

  • OfflineManager prepareAsset() exposed to Objective-C (#78, #81)

Example how to use it in Objective-C:

    OTTMediaOptions *options = [[OTTMediaOptions alloc] init];
    DTGSelectionOptions *selection = [[DTGSelectionOptions alloc] init];

    [selection setMinVideoBitrate:1000000 forCodec:TrackCodecAvc1];
    [selection setMinVideoBitrate:2000000 forCodec:TrackCodecMp4a];
    [selection setMinVideoWidth:1280];
    [selection setMinVideoHeight:720];
    [selection setAllTextLanguages:YES];
    [selection setAllAudioLanguages:YES];

    NSArray *codecs = [NSArray arrayWithObjects:
                       [NSNumber numberWithInteger:TrackCodecAvc1],
                       [NSNumber numberWithInteger:TrackCodecHevc], nil];

    [selection setPreferredVideoCodecs:codecs];
    [selection setPreferredAudioCodecs:[NSArray arrayWithObjects:[NSNumber numberWithInteger:TrackCodecAc3], nil]];


    // OTT Player
    [[OfflineManager shared] prepareAssetWithMediaOptions:options
                                                  options:selection
                                                 callback:^(NSError *error, AssetInfo *info, PKMediaEntry *entry) {
        
    }];
    
    
    // Basic Player
    PKMediaSource *source = [[PKMediaSource alloc] init:@"ID"
                                             contentUrl:[NSURL URLWithString:@"http://your-playback.com/url.m3u8"]
                                               mimeType:nil
                                                drmData:nil
                                            mediaFormat:MediaFormatHls];
    
    PKMediaEntry *entry = [[PKMediaEntry alloc] init:@"ID"
                                             sources:[NSArray arrayWithObjects:source, nil]
                                            duration:-1];
    
    [[OfflineManager shared] prepareAssetWithMediaEntry:entry
                                                options:selection
                                               callback:^(NSError *error, AssetInfo *info) {
        
    }];
  • DTGSelectionOptions func setMinVideoBitrate(_ codec: TrackCodec, _ bitrate: Int) -> Self deprecated now use func setMinVideoBitrate(_ bitrate: Int, forCodec codec: TrackCodec) -> Self

Cocoapods install

pod 'DownloadToGo', '~> 3.17.0'