Resolve base url not correct when root MPD base url start with `/`
KunXi-Fox opened this issue · 2 comments
Bug Description
Currently rx-player didn't resolve base url correctly when root MPD base url start with /
Expected behavior
resolve('/a/b/c', 'https://example.com/a') should return https://example.com/a/b/c
not https://example.com/a/a/b/c
Details
MPD Example:
MPD base url is: https://example.com/dash/index.mpd
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:mpeg:dash:schema:mpd:2011"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
profiles="urn:mpeg:dash:profile:isoff-live:2011"
type="dynamic"
minimumUpdatePeriod="PT500S"
suggestedPresentationDelay="PT1S"
availabilityStartTime="2022-12-07T08:52:13.150Z"
publishTime="2022-12-07T08:52:13.926Z"
maxSegmentDuration="PT1.0S"
minBufferTime="PT2.0S">
<BaseURL>/a/b/c/</BaseURL>
<Period id="0" start="PT0.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="25/1" maxWidth="768" maxHeight="576" par="4:3">
<Representation id="0" mimeType="video/mp4" codecs="avc1.640028" bandwidth="176736" width="768" height="576" sar="1:1">
<SegmentTemplate timescale="1000000" duration="1000000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
</SegmentTemplate>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true">
<Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="69000" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="1" />
<SegmentTemplate timescale="1000000" duration="1000000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
</SegmentTemplate>
</Representation>
</AdaptationSet>
</Period>
</MPD>
For first period
actual behavior
- Init segment url: https://example.com/dash/a/b/c/init-stream0.m4s
- first segment url: https://example.com/dash/a/b/c/chunk-stream0-0.m4s
Expected Behavior
- Init segment url: https://example.com/a/b/c/init-stream0.m4s
- First segment url: https://example.com/a/b/c/chunk-stream0-0.m4s
Hello, It looks likes the URL resolution in the RxPlayer does not met the spec for absolute path.
From the DASH spec 5.6.4 Reference resolution:
URLs at each level of the MPD are resolved according to IETF RFC 3986
Which is defined here: https://datatracker.ietf.org/doc/html/rfc3986#section-5.4.1
The example that correspond to the absolute path case:
BaseURL: "http://a/b/c/d;p?q"
relativeReference: "/g"
Output = "http://a/g"
Fixed with 4.1.0