Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additionalParameters to resolve tvg-logo/tvg-id/tvg-country or other additional properties as key-value pairs for M3U8 EXTINF. #36

Merged
merged 6 commits into from
Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions M3U8Kit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
012455C62525ABFD00AF62C3 /* M3U8ExtXByteRange.m in Sources */ = {isa = PBXBuildFile; fileRef = 012455B225257F2900AF62C3 /* M3U8ExtXByteRange.m */; };
012455D42525B8EC00AF62C3 /* M3U8LineReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B38E3F20EA30AB00AC6443 /* M3U8LineReader.h */; settings = {ATTRIBUTES = (Private, ); }; };
01B38E2C20EA2F8B00AC6443 /* M3U8KitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B38E2B20EA2F8B00AC6443 /* M3U8KitTests.m */; };
01B38E2E20EA2F8B00AC6443 /* M3U8Kit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D79F1251EF77CE400D16AFD /* M3U8Kit.framework */; };
01B38E2E20EA2F8B00AC6443 /* M3U8Parser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D79F1251EF77CE400D16AFD /* M3U8Parser.framework */; };
01B38E3420EA308F00AC6443 /* NSString+m3u8.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D79F1301EF784E500D16AFD /* NSString+m3u8.m */; };
01B38E3520EA308F00AC6443 /* NSURL+m3u8.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D79F1321EF784E500D16AFD /* NSURL+m3u8.m */; };
01B38E3620EA308F00AC6443 /* M3U8PlaylistModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D79F1351EF784E500D16AFD /* M3U8PlaylistModel.m */; };
Expand All @@ -27,7 +27,8 @@
01B38E3E20EA308F00AC6443 /* M3U8SegmentInfoList.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D79F1481EF784E500D16AFD /* M3U8SegmentInfoList.m */; };
01B38E4320EA30AB00AC6443 /* M3U8LineReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B38E4020EA30AB00AC6443 /* M3U8LineReader.m */; };
01B38E4420EA30FD00AC6443 /* M3U8LineReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B38E4020EA30AB00AC6443 /* M3U8LineReader.m */; };
9D79F1291EF77CE500D16AFD /* M3U8Kit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D79F1271EF77CE500D16AFD /* M3U8Kit.h */; settings = {ATTRIBUTES = (Public, ); }; };
01C15384287D0EFB009D0C01 /* NSArray+m3u8.h in Headers */ = {isa = PBXBuildFile; fileRef = 01C15382287D0EFB009D0C01 /* NSArray+m3u8.h */; settings = {ATTRIBUTES = (Public, ); }; };
01C15385287D0EFB009D0C01 /* NSArray+m3u8.m in Sources */ = {isa = PBXBuildFile; fileRef = 01C15383287D0EFB009D0C01 /* NSArray+m3u8.m */; };
9D79F14A1EF784E500D16AFD /* NSString+m3u8.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D79F12F1EF784E500D16AFD /* NSString+m3u8.h */; settings = {ATTRIBUTES = (Public, ); }; };
9D79F14C1EF784E500D16AFD /* NSString+m3u8.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D79F1301EF784E500D16AFD /* NSString+m3u8.m */; };
9D79F14E1EF784E500D16AFD /* NSURL+m3u8.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D79F1311EF784E500D16AFD /* NSURL+m3u8.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -78,9 +79,10 @@
01B38E2D20EA2F8B00AC6443 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
01B38E3F20EA30AB00AC6443 /* M3U8LineReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = M3U8LineReader.h; sourceTree = "<group>"; };
01B38E4020EA30AB00AC6443 /* M3U8LineReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = M3U8LineReader.m; sourceTree = "<group>"; };
01C15382287D0EFB009D0C01 /* NSArray+m3u8.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+m3u8.h"; sourceTree = "<group>"; };
01C15383287D0EFB009D0C01 /* NSArray+m3u8.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+m3u8.m"; sourceTree = "<group>"; };
9D05821D18E52DF500A12776 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
9D79F1251EF77CE400D16AFD /* M3U8Kit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = M3U8Kit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D79F1271EF77CE500D16AFD /* M3U8Kit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = M3U8Kit.h; sourceTree = "<group>"; };
9D79F1251EF77CE400D16AFD /* M3U8Parser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = M3U8Parser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D79F1281EF77CE500D16AFD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9D79F12F1EF784E500D16AFD /* NSString+m3u8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+m3u8.h"; sourceTree = "<group>"; };
9D79F1301EF784E500D16AFD /* NSString+m3u8.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+m3u8.m"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -115,7 +117,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
01B38E2E20EA2F8B00AC6443 /* M3U8Kit.framework in Frameworks */,
01B38E2E20EA2F8B00AC6443 /* M3U8Parser.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -155,7 +157,7 @@
9D05821B18E52DF500A12776 /* Products */ = {
isa = PBXGroup;
children = (
9D79F1251EF77CE400D16AFD /* M3U8Kit.framework */,
9D79F1251EF77CE400D16AFD /* M3U8Parser.framework */,
01B38E2920EA2F8A00AC6443 /* M3U8KitTests.xctest */,
);
name = Products;
Expand All @@ -172,7 +174,6 @@
9D79F1261EF77CE500D16AFD /* M3U8Kit */ = {
isa = PBXGroup;
children = (
9D79F1271EF77CE500D16AFD /* M3U8Kit.h */,
9D79F1281EF77CE500D16AFD /* Info.plist */,
);
path = M3U8Kit;
Expand All @@ -182,8 +183,8 @@
isa = PBXGroup;
children = (
011650B024483537001E4A35 /* M3U8Parser.modulemap */,
9D79F12E1EF784E500D16AFD /* Categories */,
9D79F1331EF784E500D16AFD /* M3U8Parser.h */,
9D79F12E1EF784E500D16AFD /* Categories */,
9D79F1341EF784E500D16AFD /* M3U8PlaylistModel.h */,
9D79F1351EF784E500D16AFD /* M3U8PlaylistModel.m */,
9D79F1361EF784E500D16AFD /* M3U8TagsAndAttributes.h */,
Expand All @@ -198,6 +199,8 @@
children = (
9D79F12F1EF784E500D16AFD /* NSString+m3u8.h */,
9D79F1301EF784E500D16AFD /* NSString+m3u8.m */,
01C15382287D0EFB009D0C01 /* NSArray+m3u8.h */,
01C15383287D0EFB009D0C01 /* NSArray+m3u8.m */,
9D79F1311EF784E500D16AFD /* NSURL+m3u8.h */,
9D79F1321EF784E500D16AFD /* NSURL+m3u8.m */,
);
Expand Down Expand Up @@ -255,14 +258,14 @@
9D79F1521EF784E500D16AFD /* M3U8Parser.h in Headers */,
9D79F15E1EF784E500D16AFD /* M3U8ExtXMediaList.h in Headers */,
9D79F1761EF784E500D16AFD /* M3U8SegmentInfoList.h in Headers */,
9D79F1291EF77CE500D16AFD /* M3U8Kit.h in Headers */,
9D79F14A1EF784E500D16AFD /* NSString+m3u8.h in Headers */,
9D79F1621EF784E500D16AFD /* M3U8ExtXStreamInf.h in Headers */,
9D79F14E1EF784E500D16AFD /* NSURL+m3u8.h in Headers */,
9D79F16A1EF784E500D16AFD /* M3U8MasterPlaylist.h in Headers */,
F97F1AB02204979A006F5717 /* M3U8ExtXKey.h in Headers */,
9D79F15A1EF784E500D16AFD /* M3U8ExtXMedia.h in Headers */,
012455BB2525ABA600AF62C3 /* M3U8ExtXByteRange.h in Headers */,
01C15384287D0EFB009D0C01 /* NSArray+m3u8.h in Headers */,
012455D42525B8EC00AF62C3 /* M3U8LineReader.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -288,9 +291,9 @@
productReference = 01B38E2920EA2F8A00AC6443 /* M3U8KitTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
9D79F1241EF77CE400D16AFD /* M3U8Kit */ = {
9D79F1241EF77CE400D16AFD /* M3U8Parser */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9D79F12A1EF77CE500D16AFD /* Build configuration list for PBXNativeTarget "M3U8Kit" */;
buildConfigurationList = 9D79F12A1EF77CE500D16AFD /* Build configuration list for PBXNativeTarget "M3U8Parser" */;
buildPhases = (
9D79F1201EF77CE400D16AFD /* Sources */,
9D79F1211EF77CE400D16AFD /* Frameworks */,
Expand All @@ -301,9 +304,9 @@
);
dependencies = (
);
name = M3U8Kit;
name = M3U8Parser;
productName = M3U8KitDynamic;
productReference = 9D79F1251EF77CE400D16AFD /* M3U8Kit.framework */;
productReference = 9D79F1251EF77CE400D16AFD /* M3U8Parser.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
Expand All @@ -328,18 +331,18 @@
};
buildConfigurationList = 9D05821318E52DF500A12776 /* Build configuration list for PBXProject "M3U8Kit" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
mainGroup = 9D05820F18E52DF500A12776;
productRefGroup = 9D05821B18E52DF500A12776 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
9D79F1241EF77CE400D16AFD /* M3U8Kit */,
9D79F1241EF77CE400D16AFD /* M3U8Parser */,
01B38E2820EA2F8A00AC6443 /* M3U8KitTests */,
);
};
Expand Down Expand Up @@ -400,6 +403,7 @@
9D79F1601EF784E500D16AFD /* M3U8ExtXMediaList.m in Sources */,
9D79F1641EF784E500D16AFD /* M3U8ExtXStreamInf.m in Sources */,
9D79F1561EF784E500D16AFD /* M3U8PlaylistModel.m in Sources */,
01C15385287D0EFB009D0C01 /* NSArray+m3u8.m in Sources */,
9D79F14C1EF784E500D16AFD /* NSString+m3u8.m in Sources */,
01B38E4420EA30FD00AC6443 /* M3U8LineReader.m in Sources */,
F97F1AB22204979A006F5717 /* M3U8ExtXKey.m in Sources */,
Expand All @@ -411,7 +415,7 @@
/* Begin PBXTargetDependency section */
01B38E3020EA2F8B00AC6443 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 9D79F1241EF77CE400D16AFD /* M3U8Kit */;
target = 9D79F1241EF77CE400D16AFD /* M3U8Parser */;
targetProxy = 01B38E2F20EA2F8B00AC6443 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
Expand Down Expand Up @@ -683,7 +687,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9D79F12A1EF77CE500D16AFD /* Build configuration list for PBXNativeTarget "M3U8Kit" */ = {
9D79F12A1EF77CE500D16AFD /* Build configuration list for PBXNativeTarget "M3U8Parser" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9D79F12B1EF77CE500D16AFD /* Debug */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D79F1241EF77CE400D16AFD"
BuildableName = "M3U8Kit.framework"
BlueprintName = "M3U8Kit"
BuildableName = "M3U8Parser.framework"
BlueprintName = "M3U8Parser"
ReferencedContainer = "container:M3U8Kit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -54,8 +54,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D79F1241EF77CE400D16AFD"
BuildableName = "M3U8Kit.framework"
BlueprintName = "M3U8Kit"
BuildableName = "M3U8Parser.framework"
BlueprintName = "M3U8Parser"
ReferencedContainer = "container:M3U8Kit.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -70,8 +70,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D79F1241EF77CE400D16AFD"
BuildableName = "M3U8Kit.framework"
BlueprintName = "M3U8Kit"
BuildableName = "M3U8Parser.framework"
BlueprintName = "M3U8Parser"
ReferencedContainer = "container:M3U8Kit.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down
20 changes: 0 additions & 20 deletions M3U8Kit/M3U8Kit.h

This file was deleted.

25 changes: 17 additions & 8 deletions M3U8KitTests/M3U8KitTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
//

#import <XCTest/XCTest.h>
#import "NSURL+m3u8.h"
#import "M3U8PlaylistModel.h"
#import "StringExample.h"

@import M3U8Parser;
@interface M3U8KitTests : XCTestCase

@property (nonatomic) StringExample *example;
Expand All @@ -35,11 +34,11 @@ - (void)testLoadURLAsynchronously {
XCTestExpectation *expectation = [self expectationWithDescription:@"load URL failed!"];
NSURL *url = [NSURL URLWithString:@"https://hls.ted.com/talks/2639.m3u8"];
[url m3u_loadAsyncCompletion:^(M3U8PlaylistModel *model, NSError *error) {
if (error) {
return;
}
[expectation fulfill];
}];
if (error) {
return;
}
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:15 handler:nil];
}

Expand All @@ -64,7 +63,17 @@ - (void)testPlaylistM3U {
initWithString:_example.m3u8Playlist
baseURL:baseURL
error:&error];
NSLog(@"%@", playList);
M3U8SegmentInfoList *segments = playList.mainMediaPl.segmentList;
XCTAssertEqual(segments.count, 23);

M3U8SegmentInfo *segment0 = [segments segmentInfoAtIndex:0];
XCTAssertEqual(segment0.additionalParameters.count, 5);
XCTAssertEqual(segment0.duration, 2.0);

M3U8SegmentInfo *segment1 = [segments segmentInfoAtIndex:1];
XCTAssertNil(segment1.additionalParameters);
XCTAssertEqual(segment1.duration, 2.0);

XCTAssertNil(error);
}

Expand Down
2 changes: 1 addition & 1 deletion M3U8KitTests/StringExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ - (NSString *)m3u8Playlist {
#EXT-X-TARGETDURATION:11\n\
#EXT-X-MEDIA-SEQUENCE:0\n\
#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.m3u8kit/get_video_key.php?edk=CiA61uBk9j6jp9V5Rs1LFLMDZmfgnepZhtsOyA1VJc8%2FwxCO08TAChiaoOvUBCokYjRhNjFiNTgtMmVhNy00OWYxLgwZGMtZTE0NTIyODc5YWIy&fileId=5285890782612785655&keySource=VodBuildInKMS\",IV=0x00000000000000000000000000000000\n\
#EXTINF:2.000000,\n\
#EXTINF:2.000000 logo=\"someURI/target.png\" tvg-id=\"Rotana Cinema\" tvg-country=\"SA\" tvg-language=\"Arabic\" tvg-logo=\"tvgURI/logo.png\",\n\
#EXT-X-BYTERANGE:3008@940\n\
f0.ts?start=0&end=279759&type=mpegts&t=5c7e38d0&us=838110&sign=48b2231ae4a5830973c838838d722c7d\n\
#EXT-X-KEY:METHOD=AES-128,URI=\"https://example.m3u8kit/get_video_key.php?edk=CiA61uBk9j6jp9V5Rs1LFLMDZmfgnepZhtsOyA1VJc8%2FwxCO08TAChiaoOvUBCokYjRhNjFiNTgtMmVhNy00OWYxLgwZGMtZTE0NTIyODc5YWIy&fileId=5285890782612785655&keySource=VodBuildInKMS\",IV=0x00000000000000000000000000000000\n\
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Run `carthage` to build the framework and drag the built `M3U8Kit.framework` int

### Manually

If you prefer not to use either of the above mentioned dependency managers, you can integrate `M3U8Kit` into your project manually by adding the files contained in the [Source](https://github.com/M3U8Kit/M3U8Parser/tree/master/Source) folder to your project.
If you prefer not to use either of the above mentioned dependency managers, you can integrate `M3U8Parser` into your project manually by adding the files contained in the [Source](https://github.com/M3U8Kit/M3U8Parser/tree/master/Source) folder to your project.

## Usage

Expand Down
6 changes: 3 additions & 3 deletions Source/M3U8MasterPlaylist.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (void)parseMasterPlaylist {
else if ([line hasPrefix:M3U8_EXT_X_SESSION_KEY]) {
NSRange range = [line rangeOfString:M3U8_EXT_X_SESSION_KEY];
NSString *attribute_list = [line substringFromIndex:range.location + range.length];
NSMutableDictionary *attr = attribute_list.m3u_attributesFromAssignment;
NSMutableDictionary *attr = attribute_list.m3u_attributesFromAssignmentByComma;

M3U8ExtXKey *sessionKey = [[M3U8ExtXKey alloc] initWithDictionary:attr];
self.xSessionKey = sessionKey;
Expand All @@ -89,7 +89,7 @@ - (void)parseMasterPlaylist {
else if ([line hasPrefix:M3U8_EXT_X_STREAM_INF]) {
NSRange range = [line rangeOfString:M3U8_EXT_X_STREAM_INF];
NSString *attribute_list = [line substringFromIndex:range.location + range.length];
NSMutableDictionary *attr = attribute_list.m3u_attributesFromAssignment;
NSMutableDictionary *attr = attribute_list.m3u_attributesFromAssignmentByComma;

NSString *nextLine = [reader next];
attr[@"URI"] = nextLine;
Expand Down Expand Up @@ -117,7 +117,7 @@ - (void)parseMasterPlaylist {
else if ([line hasPrefix:M3U8_EXT_X_MEDIA]) {
NSRange range = [line rangeOfString:M3U8_EXT_X_MEDIA];
NSString *attribute_list = [line substringFromIndex:range.location + range.length];
NSMutableDictionary *attr = attribute_list.m3u_attributesFromAssignment;
NSMutableDictionary *attr = attribute_list.m3u_attributesFromAssignmentByComma;
if (self.baseURL.absoluteString.length > 0) {
attr[M3U8_BASE_URL] = self.baseURL;
}
Expand Down
17 changes: 14 additions & 3 deletions Source/M3U8MediaPlaylist.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "M3U8LineReader.h"
#import "M3U8ExtXKey.h"
#import "M3U8ExtXByteRange.h"
#import "NSArray+m3u8.h"

@interface M3U8MediaPlaylist()

Expand Down Expand Up @@ -96,17 +97,27 @@ - (void)parseMediaPlaylist

if ([line hasPrefix:M3U8_EXT_X_KEY]) {
line = [line stringByReplacingOccurrencesOfString:M3U8_EXT_X_KEY withString:@""];
key = [[M3U8ExtXKey alloc] initWithDictionary:line.m3u_attributesFromAssignment];
key = [[M3U8ExtXKey alloc] initWithDictionary:line.m3u_attributesFromAssignmentByComma];
}

//check if it's #EXTINF:
if ([line hasPrefix:M3U8_EXTINF]) {
line = [line stringByReplacingOccurrencesOfString:M3U8_EXTINF withString:@""];

NSArray<NSString *> *components = [line componentsSeparatedByString:@","];
NSString *duration = components.firstObject;
if (duration) {
NSString *info = components.firstObject;
if (info) {
NSString *blankMark = @" ";
NSArray<NSString *> *additions = [info componentsSeparatedByString:blankMark];
// get duration
NSString *duration = additions.firstObject;
params[M3U8_EXTINF_DURATION] = duration;

// get additional parameters from Extended M3U https://en.wikipedia.org/wiki/M3U#Extended_M3U
if (additions.count > 1) {
// no need remove duration(first element). `m3u_attributesFromAssignmentByMark` function will skip first non-equation value.
params[M3U8_EXTINF_ADDITIONAL_PARAMETERS] = [additions m3u_attributesFromAssignmentByMark:blankMark];
}
}
if (components.count > 1) {
params[M3U8_EXTINF_TITLE] = components[1];
Expand Down
1 change: 1 addition & 0 deletions Source/M3U8Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@

#import "NSString+m3u8.h"
#import "NSURL+m3u8.h"
#import "NSArray+m3u8.h"
#import "M3U8ExtXByteRange.h"
#import "M3U8TagsAndAttributes.h"
1 change: 1 addition & 0 deletions Source/M3U8SegmentInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@property (readonly, nonatomic, strong) M3U8ExtXByteRange *byteRange;
/** Key for media data decrytion. may be for this segment or next if no key. */
@property (readonly, nonatomic, strong) M3U8ExtXKey *xKey;
@property (readonly, nonatomic, strong) NSDictionary<NSString *, NSString *> *additionalParameters;

- (instancetype)initWithDictionary:(NSDictionary *)dictionary;

Expand Down
4 changes: 4 additions & 0 deletions Source/M3U8SegmentInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ - (NSURL *)URI {
return [NSURL URLWithString:self.dictionary[M3U8_EXTINF_URI]];
}

- (NSDictionary<NSString *,NSString *> *)additionalParameters {
return self.dictionary[M3U8_EXTINF_ADDITIONAL_PARAMETERS];
}

- (NSString *)description {
NSMutableDictionary *dict = [self.dictionary mutableCopy];
[dict addEntriesFromDictionary:[self.xKey valueForKey:@"dictionary"]];
Expand Down
Loading