Skip to content

getMediaPlaylistFromMultivariantPlaylistresolves playlist URIs against the page origin instead of the multivariant playlist origin #1262

@JkmAS

Description

@JkmAS

Is there an existing issue for this?

  • I have searched the existing issues

Which Mux Elements/Packages does this apply to? Select all that apply

playback-core

Which browsers are you using?

Chrome

Which operating systems are you using?

Ubuntu

Description

I have an multivariant playlist (.m3u8 file) defined as follows:

#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,URI="360p/audio/index.m3u8",GROUP-ID="default-audio-group5537812",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="480p/audio/index.m3u8",GROUP-ID="default-audio-group5537813",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="720p/audio/index.m3u8",GROUP-ID="default-audio-group5537814",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="1080p/audio/index.m3u8",GROUP-ID="default-audio-group5537815",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="1440p/audio/index.m3u8",GROUP-ID="default-audio-group5537816",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="2160p/audio/index.m3u8",GROUP-ID="default-audio-group5537817",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="240p/audio/index.m3u8",GROUP-ID="default-audio-group5537818",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="144p/audio/index.m3u8",GROUP-ID="default-audio-group5537819",LANGUAGE="en",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-STREAM-INF:BANDWIDTH=1055069,AVERAGE-BANDWIDTH=720934,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537812",CLOSED-CAPTIONS=NONE
360p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1849647,AVERAGE-BANDWIDTH=1231347,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=854x480,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537813",CLOSED-CAPTIONS=NONE
480p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3542116,AVERAGE-BANDWIDTH=2270043,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537814",CLOSED-CAPTIONS=NONE
720p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=9307032,AVERAGE-BANDWIDTH=5851040,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537815",CLOSED-CAPTIONS=NONE
1080p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=20473575,AVERAGE-BANDWIDTH=12495293,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=2560x1440,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537816",CLOSED-CAPTIONS=NONE
1440p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=41765256,AVERAGE-BANDWIDTH=25757702,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=3840x2160,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537817",CLOSED-CAPTIONS=NONE
2160p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=605747,AVERAGE-BANDWIDTH=444649,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=426x240,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537818",CLOSED-CAPTIONS=NONE
240p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=339240,AVERAGE-BANDWIDTH=248628,CODECS="avc1.42c01e,mp4a.40.2",RESOLUTION=256x144,FRAME-RATE=23.981,VIDEO-RANGE=SDR,AUDIO="default-audio-group5537819",CLOSED-CAPTIONS=NONE
144p/index.m3u8

This multivariant playlist is fetched from a different domain than my website:
https://agmipobm-ns1.captain.vpplayer.net/XYZ/encode/vjsoarqe/hls/master_file.m3u8. However, I am seeing network requests for the variant playlists being made to my website instead, for example: https://mywebsite.com/post/test-post-32/360p/index.m3u8

This request should not be made to my website. It should be resolved relative to the multivariant playlist URL and fetched from https://agmipobm-ns1.captain.vpplayer.net/XYZ/encode/vjsoarqe/hls/360p/index.m3u8

It looks like the relative URIs (e.g. 360p/index.m3u8) are being resolved against the page origin instead of the master playlist file origin. I suspect this happens inside getMediaPlaylistFromMultivariantPlaylist, where the value from #EXT-X-STREAM-INF (for example 360p/index.m3u8) is used directly for fetching, without first using the defined domain.

Let me know if you can fix the behaviour or if there is any config that would prevent it. I haven't found any. Thank you

Reduced test case

No response

Steps to reproduce

  1. Host the example HLS multivariant playlist on a domain different from the website where the video player is embedded. For example https://agmipobm-ns1.captain.vpplayer.net/XYZ/encode/vjsoarqe/hls/master_file.m3u8
  2. Embed a video player on a webpage such as:
    https://mywebsite.com/post/test-post-32/ and configure the player to load the master playlist URL from step 1. Start playback
  3. Open the browser’s network inspector and check the playlist requests.
  4. Notice that a request is made to: https://mywebsite.com/post/test-post-32/360p/index.m3u8
    instead of being resolved relative to the master playlist origin.

Current Behavior

As described above ☝️

Expected Behavior

Relative URIs in the master playlist should be resolved relative to the master playlist location.

Errors

N/A

What version of the package are you using?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions