-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
dashjs
not defined error
#1680
Comments
I have to apologise as I realised that I had clicked the working test case first which caused the library to be loaded into the context when I subsequently tried the other button. |
I experienced this on mac OS sierra using Chrome v54.0.2840.98 and also FF v50.0.2 |
Another issue experienced the same with OSX El Capitan using Chrome(Version 55.0.2883.75), Firefox(50.0.2) and Safari. |
If you remove all the jquery stuff around the dash.js creations does it fix it $.getScript( "https://cdn.dashjs.org/latest/dash.all.min.js", function() { |
@AkamaiDASH Yeah that's basically using a non-AJAX approach like pressing the second button, but I need to bring markup from AJAX to insert the video tag first and then load the library to continue with other operations. And that's where it fails. But compared to other libraries, this one has something that is not being loaded for some reason if I try to load it once an AJAX request has been successful |
Thanks , I am trying to verify this issue within a certain scope (Jquery) VS wide spread issue since we are trying to freeze code and get RC1 out today. |
I see. Thanks for looking at this. Keep me posted about your findings please |
Unfortunately this is a JQuery issue, as per the JQuery docs, the callback
on getScript fires only after the script is loaded, not after it has
executed
https://api.jquery.com/jquery.getscript/
says "The callback is fired once the script has been loaded but not
necessarily executed."
I've never been sure of the utility of such a thing, especially as it's not
determinate if it's executed or not.
Changing initDash to something more like:
function initDash() { // init mediaelement
var s=document.createElement('script');
s.type="text/javascript";
s.onload=function() {
var player = dashjs.MediaPlayer().create();
console.log(player);
}
s.src="https://cdn.dashjs.org/latest/dash.all.min.js";
document.head.appendChild(s);
}
…On Fri, Dec 2, 2016 at 6:22 PM, Rafael Miranda ***@***.***> wrote:
I see. Thanks for looking at this. Keep me posted about your findings
please
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1680 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFLujmNzfo-3d_F3Lym-1iwI4PNTp8KOks5rEGH7gaJpZM4LCstE>
.
|
The thing is I tried using vanilla JavaScript to perform an AJAX request and do what you said and still experienced the same issue. I used jQuery to simplify the HTML |
Can you show the non-JQuery code you used, as the JQuery code makes no
attempt to have the script available when executing the callback, the
onload method I used does.
The JQuery method is wrong to be used that way. There is another way that
the code can fail even with onload - which is because dashjs is only added
to the global scope if the document is already loaded, with the above
simple documents that should be the case, but in a more realistic scenario
it wouldn't necessarily be. So if the onload callback executed while the
page was still loading that could happen. Such a case can be protected
against by only loading the script once the document is already loaded.
…On Fri, Dec 2, 2016 at 7:41 PM, Rafael Miranda ***@***.***> wrote:
The thing is I tried using vanilla JavaScript to perform an AJAX request
and do what you said and still experienced the same issue. I used jQuery to
simplify the HTML
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1680 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFLujvdt8KRfKOhGZUXWLXPy9hhK6yUmks5rEHRagaJpZM4LCstE>
.
|
Further to this, you don't even need to call dashjs.MediaPlayer.create once you have the script loaded properly since you have added |
Here's the link where I see the issue http://stijnheylen.com/mediaElementTest/ |
The implementation of Dash is inside te mediaelement.js file |
Thanks, so that does show a dashjs bug. the detectProtection function in
MediaPlayer.js introduced here:
cb90350
Doesn't work in the case where there are video elements being auto-created,
because the dash.js global is created after the auto-creation attempt. In
your case, you saw the error but that was only after the error above comes
out - which is why your reduced test case wasn't there.
So this is a real dash.js bug that will need fixing before release,
unfortunately it's an area that I'm not familar with - creating the dashjs
up front before the createAll will presumably be the best fix (it's more
reliable anyway) For you can just do the skipAutoCreate to get the same
feature.
Cheers,
…On Fri, Dec 2, 2016 at 8:04 PM, Rafael Miranda ***@***.***> wrote:
Here's the link where I see the issue http://stijnheylen.com/
mediaElementTest/
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1680 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFLujmspq95wmPx4kvK09QpDdSzBlOqlks5rEHm9gaJpZM4LCstE>
.
|
Related: #1496 |
Thanks for looking at this. I'll check the approach you proposed and keep you posted. Please keep me posted as we'll about fixing this; this is a key element in the project and it will be really nice to get it sorted out to cover most of the known scenarios |
Thanks for fixing this |
I have to following HTML files:
index.html
video.html
If I click the
Non Dynamic with dash
button I can see the console message; but if I click the other button I receive this error:MediaPlayer.js:1855 Uncaught ReferenceError: dashjs is not defined
Interesting thing is that if I try another library using the exact same files and change what I expect to see once the script is loaded there are no issues. Example, if I change the
initDash()
to this:I can see properly the console when using the
Dynamic button
. Is there something I am missing?The text was updated successfully, but these errors were encountered: