-
Notifications
You must be signed in to change notification settings - Fork 10
Added h5p url to player controller and enginecore method to request it #134
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
base: dev/2.5.0
Are you sure you want to change the base?
Added h5p url to player controller and enginecore method to request it #134
Conversation
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.
Assuming there’s a corresponding change in Materia to write H5P_URL into the global scope, and assuming anything relying on the cores' getH5PUrl functions is okay with them returning undefined, this looks okay to me.
The only nits I would pick: if the creator controller is no longer checking for .swf widgets, the player controller probably shouldn't be checking for them any more, either. And the suggested change to the creator controller, but that's not really necessary.
| if (inst_id != null) sendToCreator('initExistingWidget', [instance.name, instance.widget, keepQSet.data, keepQSet.version, BASE_URL, MEDIA_URL, H5P_URL]) | ||
| else sendToCreator('initNewWidget', [widget_info, BASE_URL, MEDIA_URL, H5P_URL]) |
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.
This works in two lines but it's a little harder to read. More verbosity would make it clearer, but would also bloat it a little. Fine either way.
| if (inst_id != null) sendToCreator('initExistingWidget', [instance.name, instance.widget, keepQSet.data, keepQSet.version, BASE_URL, MEDIA_URL, H5P_URL]) | |
| else sendToCreator('initNewWidget', [widget_info, BASE_URL, MEDIA_URL, H5P_URL]) | |
| let creatorMethod = 'initNewWidget' | |
| let args = [BASE_URL, MEDIA_URL, H5P_URL] | |
| if (inst_id != null) { | |
| creatorMethod = 'initExistingWidget' | |
| args = [ | |
| instance.name, | |
| instance.widget, | |
| keepQSet.data, | |
| keepQSet.version, | |
| ...args | |
| ] | |
| } else { | |
| args = [widget_info, ...args] | |
| } | |
| sendToCreator(creatorMethod, args) |
Adds the H5P URL to the list of parameters passed to the Materia engine core via the
initWidgetpostMessageEnables the
Materia.Engine.getH5PUrl()method to be callable from H5P widgetsPaired with ljoks/Materia#3