-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix Uncaught TypeError: Cannot read property 'type' of undefined at mtc.js:60 at mtc.js:3 at Object.MauticJS.processGatedVideos (mtc.js:60) at MauticJS.initGatedVideo (mtc.js:59) #7365
Conversation
@Enc3phale you having skills in js, can you have a look at the code ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at my comments and make changes if you agree.
@@ -396,7 +396,11 @@ public function onBuildJsForVideo(BuildJsEvent $event) | |||
|
|||
MauticJS.iterateCollection(videoElements)(function(node, i){ | |||
var playerFeatures = []; | |||
var source = node.getElementsByTagName('source')[0]; | |||
var sourceNodes = node.getElementsByTagName('source'); | |||
if (sourceNodes.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by returning here if there is no source node the functionality will still not work, even if the source is specified in the src attribute. I suggest to execute the following couple of lines only if sourceNodes.length > 0 and execute the rest of the function even if sourceNodes.length === 0. That way the functionality will also work for video tags with the src attribute
Wasn't double tested before the 2.15.2 PR merge deadline so pushing to the next release. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to reproduce the error.
This fix did not work for me.
If this issue persists could you update the PR @leo108 or if they aren't able to do so, maybe @quintmouthaan could pick it up taking into account the recommendations? |
Hi there! We now want to integrate your contribution in the Mautic 3 roadmap as 3.0.1 candidate. How to do?
Please report results by commenting on your PR to make us administration easier. In case your bugfix only apply to Mautic 2, we'll consider adding it in an extra Mautic 2 version. You can more information on how to do all of that on this blog post "Getting you PR ready for Mautic 3". |
This pull request has been mentioned on Mautic Community Forums. There might be relevant details there: |
Hello @leo108 could you please test mautic 3.0.0-beta2 and tell me if the issue is still existing?
Waiting for your feedback, i would very love to merge it in 3.0.1 if still relevant. Thanks ! |
@leo108 or @quintmouthaan if this is still an issue could you pick this up |
Codecov Report
@@ Coverage Diff @@
## staging #7365 +/- ##
=============================================
+ Coverage 35.24% 35.25% +0.01%
- Complexity 27884 27889 +5
=============================================
Files 1731 1731
Lines 96712 96409 -303
=============================================
- Hits 34088 33991 -97
+ Misses 62624 62418 -206
|
Easier steps to reproduce:
<video autoplay src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"></video>
After applying this PR, the error shouldn't show up anymore. |
Note: this functionality (Gated Video) is designed to only work if the Currently, the logic that checks if a Note on @quintmouthaan's comment above:
Problem with this is that even though this might work, the developer would need to set a node.dataset.mp4 = true;
playerFeatures = ['playpause','progress','current','duration','volume','fullscreen']; Example:
TL;DR: Mautic should ignore all video tags that don't have the @RCheesley should we mention the TL;DR in the docs as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested before with the error and after with no error:
Before:
@dennisameling indeed I feel we should ensure that this is documented!
P.S. Awesome video! |
closes #7032
Steps to reproduce
Easier steps to reproduce mentioned in #7365 (comment)
Log errors
In Console I see the following error:
Test PR
Re-do it