Skip to content

Shaka Player using incorrect encoding for + plus symbol %20 space instead of %2B in parameters #8713

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

Open
desertwindy opened this issue Jun 7, 2025 · 3 comments
Assignees
Labels
component: HLS The issue involves Apple's HLS manifest format priority: P2 Smaller impact or easy workaround type: bug Something isn't working correctly
Milestone

Comments

@desertwindy
Copy link

**
yes i have read
Have you read the FAQ and checked for duplicate open issues?

If the problem is related to FairPlay, have you read the tutorial?
not related to drm but url encoding and decoding problem

What version of Shaka Player are you using?

latest 4.14.14

Can you reproduce the issue with our latest release version?
yes

Can you reproduce the issue with the latest code from main?
yes

Are you using the demo app or your own custom app?

https://cdn.jsdelivr.net/npm/[email protected]/dist/shaka-player.ui.min.js

https://cdn.jsdelivr.net/npm/[email protected]/dist/controls.min.css

If custom app, can you reproduce the issue using our demo app?
yes

What browser and OS are you using?
tried with chrome firefox and edge

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
no

What are the manifest and license server URIs?
https://dai.google.com/ssai/event/yeYP86THQ4yl7US8Zx5eug/master.m3u8
(CORS enable for akamaized.net with Indian IP VPN)

What did you do?
JW plays smooth but shaka dont

What did you expect to happen?
if my m3u8 was correct then jw should not be playing also but its working excellently

What actually happened?
described in detail below

Follow this process to experience the issue yourself

CORS should be enabled
Use Indian IP or India Location VPN

this issue manily occurs in akamaized links as they how they use their session id parameter

first play https://dai.google.com/ssai/event/yeYP86THQ4yl7US8Zx5eug/master.m3u8 in jw player
(Cors enable and indian ip or vpn)

(CORS enabled because it wont play without CORS, i used https://mybrowseraddon.com/access-control-allow-origin.html this extension for playing this stream
and used Choose a value for Access-Control-Allow-Origin (* or ORIGIN). used * instead of origin in its options)

or you can use hlsjs website link instead of JW player
https://hlsjs.video-dev.org/demo/?src=https%3A%2F%2Fdai.google.com%2Fssai%2Fevent%2FyeYP86THQ4yl7US8Zx5eug%2Fmaster.m3u8

open dev tools you will see in network tab master_108.m3u8 or some master_224, 412, 664, 900, 1300, 2000, 3500 .m3u8 which shows their video resolution

suppose we pick master_3500.m3u8
https://sony247channels.akamaized.net/hls/live/2011747-b/TEN1HD/hdntl=exp=1749361337~acl=%2f*~id=c7011ca4-d345-44f5-9bc7-a0f1225b8bc0~data=hdntl~hmac=803596ac99b3a8eb87f81a62b3e3b3691458c31c3611fa35296127dbb3a5c322/master_3500.m3u8?aka_me_session_id=AAAAAAAAAAC5IkVoAAAAAHugU06feeiYbUzJzbPH9d3UIflHbyxtO5sTcf0F5MJ9Jjl9iX6qxaF14NjCvhjyQHmg+Z94gJNW&aka_media_format_type=hls&originpath=/linear/hls/pb/event/yeYP86THQ4yl7US8Zx5eug/stream/693fffb1-745c-4aaa-8a94-482b6ffa1393:TPE2/variant/edbac99ec611d03d37ffab7b990a62ef/bandwidth/4571600.m3u8

now copy this url

now play this copied url in JW player or play in https://hlsjs.video-dev.org/demo/ website
it will play smoothly and will never show any error

now try to play this url in shaka player
it will load the the first segment correctly and play
but when moving to next it will not load because the url is encoded incorrectly internally by shaka player

the url i give above will be used in subsequently in other players but in shaka it willl slightly changed e.g. aka_me_session_id= in that which will give error as akamai exact session id

https://sony247channels.akamaized.net/hls/live/2011747-b/TEN1HD/hdntl=exp=1749361337~acl=/*~id=c7011ca4-d345-44f5-9bc7-a0f1225b8bc0~data=hdntl~hmac=803596ac99b3a8eb87f81a62b3e3b3691458c31c3611fa35296127dbb3a5c322/master_3500.m3u8?aka_me_session_id=AAAAAAAAAAC5IkVoAAAAAHugU06feeiYbUzJzbPH9d3UIflHbyxtO5sTcf0F5MJ9Jjl9iX6qxaF14NjCvhjyQHmg%20Z94gJNW&aka_media_format_type=hls&originpath=/linear/hls/pb/event/yeYP86THQ4yl7US8Zx5eug/stream/693fffb1-745c-4aaa-8a94-482b6ffa1393:TPE2/variant/edbac99ec611d03d37ffab7b990a62ef/bandwidth/4571600.m3u8

this will not load and give 403 error from akamai server
look at this
aka_me_session_id=
it is changed like + plus symbol changed to space %20 instead of %2B which we didnt want
it remains same in other players but not in shaka

good thing is sometimes when aka_me_session_id does not conatin special characters then it plays smooth in shaka player also.
so main problem most probably is how shaka treats special characcters in parameters, other players use as it is like hlsjs and jw but shaka dont

but here we are talking about auto generated akamai links, akamai give session id and expiry tokens to links automatically and other things which are necessary for their purpose, which can be played smoothly by all other players except shaka so we need permanent sloution which other players follow but shhaka dont

Due to this special characters percentage encoding in session id thing, akamai links dont work in shaka but in others

in aka_me_session_id=AAAAAAAAAAC5IkVoAAAAAHugU06feeiYbUzJzbPH9d3UIflHbyxtO5sTcf0F5MJ9Jjl9iX6qxaF14NjCvhjyQHmg+Z94gJNW
plus (+) symbol is treated as space %20 in shaka while in other player it is treated as (+) plus symbol as it is

** Hence, it is because of just + plus symol only, it is converted in to %20 instead of %2B when encoding the parameter**

Just because of plus + symbol incorrect encoding whole url crashes. Need just that shaka encoded + into %2B instaed %20


This mainly occurs in akamaized streams where they use "aka_me_session_id="

This issue does not occur in other players like JW Player, which properly preserve the original URL encoding from the playlist throughout the request process.

Master playlist URL (working in JW Player):
https://dai.google.com/ssai/event/yeYP86THQ4yl7US8Zx5eug/master.m3u8

also i tried to play this url in android chrome app, justed pasted the link , it worked
also in hls.js
also in clappr
also in plyr
also in JW
(remember CORS is enabled and Indian IP)

all worked but only shaka failed

all other players treat + symbol (check %20 and %2B in below session id)
aka_me_session_id=AAAAAAAAAAC5IkVoAAAAAHugU06feeiYbUzJzbPH9d3UIflHbyxtO5sTcf0F5MJ9Jjl9iX6qxaF14NjCvhjyQHmg%20Z94gJNW - how shaka treats

as

aka_me_session_id=AAAAAAAAAAC5IkVoAAAAAHugU06feeiYbUzJzbPH9d3UIflHbyxtO5sTcf0F5MJ9Jjl9iX6qxaF14NjCvhjyQHmg%2BZ94gJNW - how other other players treat

@desertwindy desertwindy added the type: bug Something isn't working correctly label Jun 7, 2025
@shaka-bot shaka-bot added this to the v4.16 milestone Jun 7, 2025
@desertwindy
Copy link
Author

const networkingEngine = player.getNetworkingEngine();
networkingEngine.clearAllRequestFilters();
networkingEngine.registerRequestFilter((type, request) => {
if (request.uris && request.uris.length) {
request.uris = request.uris.map(uri => {
if (uri.toLowerCase().includes('akamaized')) {
return uri.replace(/%20/g, '+').replace(/%2B/gi, '+');
}
return uri;
});
}

});

it worked with this

@tykus160 tykus160 marked this as a duplicate of #8712 Jun 9, 2025
@tykus160 tykus160 added component: HLS The issue involves Apple's HLS manifest format priority: P2 Smaller impact or easy workaround labels Jun 9, 2025
@tykus160
Copy link
Member

tykus160 commented Jun 9, 2025

@desertwindy I don't have access to Indian VPN unfortunately. Can you share raw manifest files either here or on private channel so we can debug it? Or HAR file with request history from your browser?

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 9, 2025
@desertwindy
Copy link
Author

desertwindy commented Jun 9, 2025

@tykus160 @avelad

Link for Zip file is this
Shaka and JW har.zip

I have uploaded .har files in zip files named shaka and jw from both players

Shaka.har version is this
https://cdn.jsdelivr.net/npm/[email protected]/dist/shaka-player.ui.min.js

See .m3u8 requests only

In Shaka you can check the failed 403 error vs successful url and check that encoding of + symbol
Only first request of .m3u8 of that particular quality level is successful while other failed

JW.har player is this
https://content.jwplatform.com/libraries/KB5zFt7A.js

In JW, it remains plus symbol as it is on all m3u8 requests

My suggestion is this that encoding of url should be done like how JW and hlsjs do with their m3u8 links

Also with dash mpd links, JW player does the best
Like in some dash streams, shaka shows only 1 quality resolution which is generally the lowest while JW shows all quality resolutions

Only upperhand Shaka has that it supports multiple clearkeys in dash while JW cant

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: HLS The issue involves Apple's HLS manifest format priority: P2 Smaller impact or easy workaround type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

4 participants