You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Player does not work when captions are unavailables on Youtube #554
I've been struggling for quite some time with what seemed to be a random bug.
As you can see on this page the video player is loaded but no controls are available whereas on this other page it works perfectly.
Without errors in the browser console I had to dig a lot to understand that in the first case, captions are not available at all (not even auto-generated ones so the button is disabled on the Youtube player), while in the second case auto-generated captions are available (on Youtube only, AblePlayer doesn't seem to support them for now).
I hope this gives you enough context to find a fix!
Feel free to ask me if you need more info.
Thank you for your answer, Edouard! We are using this player too much now
to just dismiss it I'll need to find some way to address this. If it's
anything workable for someone else, I will certainly share it.
On Wed, May 17, 2023 at 6:28 AM Edouard Cunibil ***@***.***> wrote:
Sadly we had to remove AblePlayer for Youtube videos because of this
issue. We kept it for self hosted ones and for audio content though.
—
Reply to this email directly, view it on GitHub
<#554 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHSPEQ7472LTRAIVIOVNKJ3XGTHBFANCNFSM6AAAAAASNIJJ7U>
.
You are receiving this because you commented.Message ID:
***@***.***>
Hi All. Sorry for my slow response to this and other issues. Things have been a bit crazy at the University of Washington and maintaining Able Player has taken a back seat to other priorities. I'm planning to shift my focus back to Able Player starting next week (Monday May 22). Stay tuned for updates...
On Wed, May 17, 2023 at 12:39 PM Terrill Thompson ***@***.***> wrote:
Hi All. Sorry for my slow response to this and other issues. Things have
been a bit crazy at the University of Washington and maintaining Able
Player has taken a back seat to other priorities. I'm planning to shift my
focus back to Able Player starting next week (Monday May 22). Stay tuned
for updates...
—
Reply to this email directly, view it on GitHub
<#554 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHSPEQ6B23GGQJGZ2LSHSXTXGUSQBANCNFSM6AAAAAASNIJJ7U>
.
You are receiving this because you commented.Message ID:
***@***.***>
Can someone provide a URL to a page that demonstrates this problem? I'm unable to replicate it. From my tests, the Able Player chrome is built without error for YouTube videos that have no captions as well as those that have machine-generated captions only. Also, be sure you're using the latest version of Able Player from the develop branch.
We have a home-rolled script that sets up ableplayer within a page multiple times based on class cues found. Currently using 4.4.67, however, my tests use 4.5, which set up with the same problem as 4.4.67 (no control bar, sometimes autoplays).
I'm suffering from this problem too and the link @drumwhacker provided above shows the exact same behaviour as I see. I've compared the latest dev build to the release version and there are no changes in the area where I think the problem lies.
I have tried to debug the problem and here's what I think the issue is.
In AblePlayer.prototype.getYouTubeCaptionTracks() it determines there are no options for 'captions' or 'tracklist' so it's adds an event handler like this:
// no tracks were found, probably because the captions module hasn't loaded // play video briefly (required in order to load the captions module) // and after the apiChange event is triggered, try again to retreive tracks this.youTubePlayer.addEventListener('onApiChange',function(x)
However, as there are no captions in the video, the captions module never loads so onApiChange never gets raised. This means the video plays, doesn't get paused and deferred.resolve(); never gets called.
The impact is the chain of If statements in AblePlayer.prototype.recreatePlayer = function () stops at thisObj.getTracks().then(function() and doesn't cascade down to create the player controls (as well as other stuff).
It seems we need to know that the event handler has been added and the video has started playing but the apiOnChange event hasn't fired and is never going to. Alternatively if the captions state is unknown for a given period of time just give up and resolve the promise.
Hello Stu,
This makes sense. This would explain why the video keeps playing even
though it is not supposed to (auto) play by default.
There is a script I've placed in similar situations where, after a certain
number of tries, the deferred resolves or fails. I think I'll give that a shot.
-drum
On Mon, Jun 19, 2023, 9:07 AM Stu Price ***@***.***> wrote:
Hi
I'm suffering from this problem too and the link @drumwhacker
<https://github.com/drumwhacker> provided above shows the exact same
behaviour as I see. I've compared the latest dev build to the release
version and there are no changes in the area where I think the problem lies.
I have tried to debug the problem and here's what I think the issue is.
In AblePlayer.prototype.getYouTubeCaptionTracks() it determines there are
no options for 'captions' or 'tracklist' so it's adds an event handler like
this:
// no tracks were found, probably because the captions module hasn't
loaded // play video briefly (required in order to load the captions
module) // and after the apiChange event is triggered, try again to
retreive tracks
this.youTubePlayer.addEventListener('onApiChange',function(x)
However, as there are no captions in the video, the captions module never
loads so onApiChange never gets raised. This means the video plays,
doesn't get paused and deferred.resolve(); never gets called.
The impact is the chain of If statements in AblePlayer.prototype.recreatePlayer
= function () stops at thisObj.getTracks().then(function() and doesn't
cascade down to create the player controls (as well as other stuff).
It seems we need to know that the event handler has been added and the
video has started playing but the apiOnChange event hasn't fired and is
never going to. Alternatively if the captions state is unknown for a given
period of time just give up and resolve the promise.
I hope this helps and makes sense.
—
Reply to this email directly, view it on GitHub
<#554 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHSPEQ4LYP5WXBLZDNNLNZ3XMB2MNANCNFSM6AAAAAASNIJJ7U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
If you hard-refresh the test page I shared, you can see in the code where I have set up in the area you pointed out. The timeout is arbitrary, probably could be a lot short like 500 or 300.
I'm not managing to get this working reliably, and it's a relatively low priority scenario (videos with no captions are not really the target need for Able Player), so I'm going to move it to the next milestone.
Hello all,
The solution I set up works well in our environment but understandably not
a *solid* solution because it's basically a "shot in the dark" polling-like
bolt-on to increase the chance of getting a caption from captionModule if
there is one but also then releasing the script to finish building the
controls.
In our environment, we try to make it a policy to provide a vtt for ALL our
ableplayer setups. Since they override anything provided on youtube, we can
set a vtt to simply state "this video needs no captions" and use a
description file if needed.
This helps ensure ableplayer consistently sets itself up regardless of the
caption situation.
A bit hackey but just throwing the idea out for you all's consideration.
Claire Griese
Application Developer
Rio Salado College
I found another way to possibly solve this. There's an undocumented path to use setOption to set a caption file, and if there are no captions available in that language, it will enable the auto captions generated by YouTube.
This does two things: 1) it would make craptions available if no captions are provided and 2) might mean that this error with uncaptioned videos doesn't happen.
I did some tests, and it does work in a basic scenario, but there's a fair amount more to do to make it work properly.
I was just testing this, and in my testing today, I'm finding that this issue isn't occurring anymore - the captions module is getting loaded, and the controls execute. I could use a second confirmation on this, but I'm pretty sure this has changed.
In my test, I was able to get confirmation that the video I tested with had no captions on YouTube, but the controls rendered as expected. I did this both with the current develop branch and the 4.7 release.
Sadly, I'm still seeing this on develop and 4.7. I'm testing using a YouTube video with no words whatsoever. Examples are easy to find, like this for example https://www.youtube.com/watch?v=1x28RF72xZc
Must be that they resolved an issue with auto captions that I was finding previously, but no text is a different issue. Thanks for the example; I'll keep working. Unfortunately, this probably means that the alternate fix I'd come up with is irrelevant for this issue, as I doubt it would work in this scenario. But I'll find out.
I'm thinking that the most stable and consistent solution is to add a flag that indicates that a video doesn't have captions, and use that to disable the entire captions fetch process. Something like data-youtube-nocaptions. It's not automatic, but given that as things are right now, there cannot be any Able Players out there that are functional in this scenario, I don't think that's a major concern.
While the timeout solution works, I'm concerned that it will have the side effect that a delay > 1s in loading the captions module will result in captions being disabled. I'm not sure how big a problem that is, however, and haven't been able to trigger it. I used a test case with 23 caption files, which wasn't a problem.
For now, I'm going to commit the setTimeout solution to develop to try and get further testing, but I'm going to leave this open.
If only the YouTube iFrame API had a way to differentiate between "this module has not loaded yet" and "this module will not load"...
I can see how those might be two separate issues (1 - not finding captions that exist; 2 - not finding any captions because they don't exist at all).
It would be nice if there was a way to automatically detect the absence of captions, but if that isn't feasible then a flag or attribute would suffice.
Activity
xerc commentedon Dec 10, 2022
remove
data-hide-controls="false"and addplaysinlinebtw/ there is no need for
="true"@data-youtube-nocookieDuaelFr commentedon Dec 12, 2022
Thank you @xerc for your suggestions but it does not fix the issue.
xerc commentedon Dec 12, 2022
caption-functions do not behave "normal" with YT ; #562
drumwhacker commentedon May 16, 2023
Having this issue as well. Did you decide not to use the player?
DuaelFr commentedon May 17, 2023
Sadly we had to remove AblePlayer for Youtube videos because of this issue. We kept it for self hosted ones and for audio content though.
drumwhacker commentedon May 17, 2023
terrill commentedon May 17, 2023
Hi All. Sorry for my slow response to this and other issues. Things have been a bit crazy at the University of Washington and maintaining Able Player has taken a back seat to other priorities. I'm planning to shift my focus back to Able Player starting next week (Monday May 22). Stay tuned for updates...
drumwhacker commentedon May 17, 2023
terrill commentedon Jun 13, 2023
Can someone provide a URL to a page that demonstrates this problem? I'm unable to replicate it. From my tests, the Able Player chrome is built without error for YouTube videos that have no captions as well as those that have machine-generated captions only. Also, be sure you're using the latest version of Able Player from the develop branch.
drumwhacker commentedon Jun 15, 2023
Hi Terrill, You can view what happens for me here:
https://riosalado.coursearc.com/content/toolbox/cg-test-blocks/ableplayer-v1-set-up-no-caption-track/
We have a home-rolled script that sets up ableplayer within a page multiple times based on class cues found. Currently using 4.4.67, however, my tests use 4.5, which set up with the same problem as 4.4.67 (no control bar, sometimes autoplays).
stuprice commentedon Jun 19, 2023
Hi
I'm suffering from this problem too and the link @drumwhacker provided above shows the exact same behaviour as I see. I've compared the latest dev build to the release version and there are no changes in the area where I think the problem lies.
I have tried to debug the problem and here's what I think the issue is.
In
AblePlayer.prototype.getYouTubeCaptionTracks()it determines there are no options for 'captions' or 'tracklist' so it's adds an event handler like this:// no tracks were found, probably because the captions module hasn't loaded // play video briefly (required in order to load the captions module) // and after the apiChange event is triggered, try again to retreive tracks this.youTubePlayer.addEventListener('onApiChange',function(x)However, as there are no captions in the video, the captions module never loads so
onApiChangenever gets raised. This means the video plays, doesn't get paused anddeferred.resolve();never gets called.The impact is the chain of
Ifstatements inAblePlayer.prototype.recreatePlayer = function ()stops atthisObj.getTracks().then(function()and doesn't cascade down to create the player controls (as well as other stuff).It seems we need to know that the event handler has been added and the video has started playing but the
apiOnChangeevent hasn't fired and is never going to. Alternatively if the captions state is unknown for a given period of time just give up and resolve the promise.I hope this helps and makes sense.
drumwhacker commentedon Jun 19, 2023
drumwhacker commentedon Jun 19, 2023
If you hard-refresh the test page I shared, you can see in the code where I have set up in the area you pointed out. The timeout is
arbitrary, probably could be a lot short like 500 or300.stuprice commentedon Jun 20, 2023
Hi
I can see your page no longer autoplays the video but it still doesn't show the player controls so we're 50% of the way there.
However I can't see any of the changes you've made to make this happen? Can you give me a pointer?
I'll try and have a go today to fix the ableplayer source when captions are missing.
Cheers
Stu
21 remaining items
joedolson commentedon Jul 24, 2025
@drumwhacker I added a PR with what I understand you to be doing linked to this issue. Let me know if I've understood correctly.
I did change the call to
.stopVideo()to.pauseVideo(), as stopVideo cancels loading.What I'm finding is that it works part of the time; it's just not 100% dependable for me.
joedolson commentedon Jul 24, 2025
OK. Fixed the PR; it's based against the develop branch.
joedolson commentedon Aug 10, 2025
I'm not managing to get this working reliably, and it's a relatively low priority scenario (videos with no captions are not really the target need for Able Player), so I'm going to move it to the next milestone.
drumwhacker commentedon Aug 11, 2025
joedolson commentedon Aug 12, 2025
I found another way to possibly solve this. There's an undocumented path to use
setOptionto set a caption file, and if there are no captions available in that language, it will enable the auto captions generated by YouTube.This does two things: 1) it would make craptions available if no captions are provided and 2) might mean that this error with uncaptioned videos doesn't happen.
I did some tests, and it does work in a basic scenario, but there's a fair amount more to do to make it work properly.
However, to test it at a basic level, you can add
in the
elseblock if there are noytTrackingetYouTubeCaptionTracks().Also need to set
thisObj.usingYouTubeCaptions = false;andthisObj.hasCaptions = false;totruein that condition.I'm not going to explore this further until I start prepping 4.8, but this might be an alternate path.
joedolson commentedon Dec 31, 2025
I was just testing this, and in my testing today, I'm finding that this issue isn't occurring anymore - the captions module is getting loaded, and the controls execute. I could use a second confirmation on this, but I'm pretty sure this has changed.
In my test, I was able to get confirmation that the video I tested with had no captions on YouTube, but the controls rendered as expected. I did this both with the current develop branch and the 4.7 release.
cscottjames commentedon Dec 31, 2025
Sadly, I'm still seeing this on develop and 4.7. I'm testing using a YouTube video with no words whatsoever. Examples are easy to find, like this for example https://www.youtube.com/watch?v=1x28RF72xZc
joedolson commentedon Dec 31, 2025
Must be that they resolved an issue with auto captions that I was finding previously, but no text is a different issue. Thanks for the example; I'll keep working. Unfortunately, this probably means that the alternate fix I'd come up with is irrelevant for this issue, as I doubt it would work in this scenario. But I'll find out.
joedolson commentedon Dec 31, 2025
I'm thinking that the most stable and consistent solution is to add a flag that indicates that a video doesn't have captions, and use that to disable the entire captions fetch process. Something like
data-youtube-nocaptions. It's not automatic, but given that as things are right now, there cannot be any Able Players out there that are functional in this scenario, I don't think that's a major concern.While the timeout solution works, I'm concerned that it will have the side effect that a delay > 1s in loading the captions module will result in captions being disabled. I'm not sure how big a problem that is, however, and haven't been able to trigger it. I used a test case with 23 caption files, which wasn't a problem.
For now, I'm going to commit the setTimeout solution to develop to try and get further testing, but I'm going to leave this open.
If only the YouTube iFrame API had a way to differentiate between "this module has not loaded yet" and "this module will not load"...
Add setTimeout to resolve promise if no captions found.
cscottjames commentedon Jan 2, 2026
I can see how those might be two separate issues (1 - not finding captions that exist; 2 - not finding any captions because they don't exist at all).
It would be nice if there was a way to automatically detect the absence of captions, but if that isn't feasible then a flag or attribute would suffice.
joedolson commentedon Jan 10, 2026
This seems to be working; I'm going to ship with it this way, and if I need to do a follow up, I'll do that.