ResolutionAttributeInstance not accessible?

Feb 2, 2015 at 2:21 PM
When parsing the m3u8 file I'd like to access the Resolution value, but it looks like ResolutionAttributeInstance is not accessible in any way.
Is this a bug, or there is other way, how to access the resolution information from m3u8 playlist for selected stream?
Feb 2, 2015 at 4:49 PM
Are you looking for the resolution attribute from an instance of M3U8Parser or when looking at ISubProgram instances (e.g., in the PlaylistSegmentManagerPolicy.SelectSubProgram handler)?

If the former, then take a look at how HlsProgramManager's LoadAsync() gets the bandwidth attribute:
            foreach (var p in parser.Playlist)
                if (null == p.Tags || p.Tags.Length < 1)
                    hasSegments = true;

                var streamInf = M3U8Tags.ExtXStreamInf.Find(p.Tags);

                if (null != streamInf)
                    var bandwidth = streamInf.Attribute(ExtStreamInfSupport.AttrBandwidth);
The resolution can be found through ExtStreamInfSupport.AttrResolution. Since it is not a subclass of M3U8AttributeValueInstance<TValue>, it can't use the M3U8ValueAttribute<TValue> based extension methods. One can get at it like this:
    var resolution = streamInf.Attributes(ExtStreamInfSupport.AttrResolution).FirstOrDefault() as ResolutionAttributeInstance;
If you meant getting at the resolution through ISubProgram's Height and Width properties, then that isn't currently supported. There is no good reason why those properties aren't set, so I'll try to commit a change in the next day or so.
Feb 3, 2015 at 11:10 AM
Yes, I've tried to use the code in the second block myself already, but the problem is that ResolutionAttributeInstance is internal class in SM.Media and cannot be used in my app. I can change it myself in the source code and compile it, I was just wondering, if there was another non-internal way of getting the Resolution already or this modification is right now the only way?
Feb 3, 2015 at 4:48 PM
Ah. Good point.

It looks like many of the other classes in AttributeSupport are also internal. I'll change the code, but in the meantime, I think you'll need to muck with the code on your end.
Feb 3, 2015 at 7:00 PM
Does fd6f0dc796f4 help?
Feb 4, 2015 at 7:39 AM
Thanks, that should do it. I really appreciate your work and fast fixes :)