WS-2095: Updates video plugins to use Var#13722
Conversation
There was a problem hiding this comment.
Pull request overview
Renames the public SMP video overlay plugin entrypoint function, likely as part of addressing an iPhone Safari playback/overlay issue.
Changes:
- Renamed the plugin initializer from
runPlugintorunVideoOverlayPlugin. - Updated the CommonJS export to export
runVideoOverlayPlugininstead ofrunPlugin.
|
For this line and the same in the fullscreen plugin, we could try changing it tovar runPlugin instead of const runPlugin.
That should let you re-declare the same value, but not sure on how it will actually behave in reality. |
Good idea. I've actually updated it based on some copilot advice, suggesting the issue was being caused by the export provided for unit tests (that import this plugin in a Node/CommonJS environment). I don't actually think we're using this and just copied it from SMP. |
I think it'll need exported to some degree though as otherwise there is no function that can be executed by SMP? |
Ahhh ok, I was following public/smpPlugins/fullscreen.js - but I can see this is used in a different way. I've updated to include an export. Does this look ok? Copilot says:
|
Ah sorry! I thought for sure we did the same thing in I think it will still trip up though if its left as |
Cool, I have followed the approach in the PS plugin to use var and added some eslint-disable comments. |
Thanks 👍 Do you think we should update the |
|
Any reason why we're using |
|
Yep makes sense - heads up I have got these changes temporarily going onto preview via this PR so hopefully I can check they work. |
| const fullScreenPlugin = new FullScreenPlugin(); | ||
|
|
||
| return fullScreenPlugin; | ||
| }; |
There was a problem hiding this comment.
The fullscreen.js plugin is missing the same module.exports pattern that was added to video-overlay-plugin.js. Based on the comment in video-overlay-plugin.js about exporting for tests, this plugin should also have a similar export mechanism if it needs to be tested.
Currently, fullscreen.js declares runPlugin but never exports it, which means it can only be used when loaded as a script tag by SMP and cannot be imported or tested in a Node.js environment. Consider adding the same typeof check and export pattern for consistency.
| }; | |
| }; | |
| if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | |
| module.exports = runPlugin; | |
| } |
Resolves JIRA: WS-2095
Summary
Fix to try resolve safari iphone issue (slack)
Code changes
Testing
Useful Links