ExoPlayer
ExoPlayer copied to clipboard
Is there a way to read some tags values in dash manifest?
is there anyone in Exo player to read the below data images ?
thank you
ExoPlayer is parsing the SegmentTimeline
element and makes it part of the DashManifest
(see DashManifestParser
).
After the DASH stream is prepared, you can find a field Window.manifest
in the window of the given DASH stream which is of type DashManifest
(needs to be cast from Object
). Given your manifest is a multi segment manifest you can get the MultiSegmentRepresentation
as follows:
MultiSegmentRepresentation multiSegmentRepresentation =
dashManifest
.getPeriod(periodIndex)
.adaptationSets.get(adaptationSetIndex)
.representations.get(representationIndex);
You can then query for the segements with the methods provided by MultiSegmentRepresentation
.
I think you can't access timescale
and presentationTimeOffset
as these are used internally to calculate the startTime
and duration
of a SegmentTimelineElement
and are not exposed to the public.
I hope this helps. If not please let me know what you are trying to achieve, so I can assist you some further.
@marcbaechinger another question is there a way to get the manifest in string format ??? thank you because i had a solution where i can get the manifest in string and extract the values i want from that value
ExoPlayer does not download the manifest as a string but parses it with an pull parser and translates it directly into the DashManifest
structure. You can create your DashMediaSource
by using the DashMediaSource.Factory
and then use setManifestParser
to set a custom parser. Most of the methods of the DashManifestParser
are protected so you can override and intercept them.
I don't know your use case or reasons why you would want to use a XML file instead, but given you find the values in the DashManifest
I would take it from there. It's the easiest way. The XML structure is more complex and the DashManifestParser
does normalize some things for you when creating the DashManifest
.
im just trying to get those values i mentioned in the images above i tried everything and nothing worked
so im just thinking of reading the manifest as string and extract those values using regular expression
I can't help you any further with this I'm afraid. I don't think that regex is an easy way to parse the values out of an XML file specifically with multiple adaption sets as in this case, but my regex skills are limited indeed.
If the DashManifest
or DashManifestParser
isn't of any help for you then you need to download the manifest yourself to get a string I think.
I'm leaving this issue open for while in case someone else has some further ideas and wants to contribute.
Alright lemme tell you what im trying to do maybe u can come up wth better soluation
so basically im working on SSAI project and for the dashed live stream the there is no current Time value so what im doing im calculating it by getting the period start time and adding second to it every second
so im calculating the start time of the period by using this equation
PeriodStartTime + (T start value - presentationTimeOffset) / timeScale
that's why i need those values