Unfortunately it was going to be difficult to break this functionality into separate patches, since the code is so closely interconnected. We are including four items in this patch:
* Include preset sources option
* Include Sharing Sites option
* Include Mute option
* Improve form validation
The preset sources option in particular needs some explanation. The current 7.x-2.x setup does not allow for local preset settings to override player settings. Also, there is no option to allow developers to use a predefined JW Player preset on the site. What we're attempting to do is meet the conditions shown shown here in this 2x2 diagram:
https://support.jwplayer.com/customer/portal/articles/1406723#fndtn-meth...
There needs to be support for choosing to use JW Player or Drupal as the source for preset information.
The other items in the list are fairly straightforward. Sharing Sites allows for configuration of sharing options with the player (facebook, twitter, email, etc.). Mute allows for the player to start with sound disabled. This is extremely important for sites that want to autostart the player, but do so with sound disabled (this is a common feature on many websites these days).
The final piece is improved validation. There are lots of places in the admin forms that need better data checking, such as:
* Display only the necessary fields on the admin settings page based on version and hosting.
* Require cloud player URL if hosting is set to cloud-based.
* Require cloud player URL to match format of JW Player's URLs.
* Require license key if hosting type is self-hosted.
* Require width field to be between 0% and 100% if dimensions are responsive.
* Require aspect ratio format to be two numbers separated by a colon.
* Require width and height formats to be greater than 0.
* Require player library URL to match format set by JW Player.
Comment | File | Size | Author |
---|---|---|---|
#37 | interdiff-2713701-35-37.txt | 5.92 KB | johnchque |
#37 | add_preset_sources-2713701-37.patch | 46.77 KB | johnchque |
| |||
#35 | interdiff-2713701-32-35.txt | 10.1 KB | johnchque |
#35 | add_preset_sources-2713701-35.patch | 44.92 KB | johnchque |
| |||
#32 | interdiff-2713701-31-32.txt | 4.02 KB | johnchque |
Comments
Comment #2
ron_s CreditAttribution: ron_s commentedAttached is the patch for review. Please note, the playlist options have been re-enabled in this patch with a check against using the legacy version of JW Player. More about this will be seen in the next patch we have for refactoring the module theming.
Also very important to note, the formatter summaries for Sharing Sites and Mute will *not* be shown without another patch we created: https://www.drupal.org/node/2713687
Please apply the #2713687 patch to see the options.
Comment #3
ron_s CreditAttribution: ron_s commentedMaking a note regarding this request for the Loop option: https://www.drupal.org/node/1330634
Once we're able to get these patches committed, it will be easy to add Loop to the updated admin layout.
Comment #4
BerdirIsn't this implied by the license key vs cloud hosted option? What do we gain from an additional setting?
Can't we just say that either the license key or the cloud url must be provided? Not sure what we should do when both are added.
What if each preset has a checkbox "[x] Override cloud presets" or so? That's something that I've been thinking about. The other idea we've had is to have a per-preset cloud url (that's why the default one is called... default).
I see, that's basically what you did here.
why make it a library when you then add it with #attached js?
Comment #5
ron_s CreditAttribution: ron_s commentedThere are two main ideas. The first is to try to streamline the process. For someone who is not as knowledgeable about self vs. cloud, 6 vs. 7, etc. it is possible to create a situation where settings are saved that won't work. For example, I'm quite sure cloud-hosting wasn't an option in JW Player 5. However the form as constructed will allow that to happen.
The second idea is clearly identifying if the user will or will not be using the cloud. This is what allows us to later in the options ask for the Preset Source setting. If a user has decided to self-host, we don't need to ask about Preset Sources, because we know everything will be done on Drupal.
Sure, we are saying that indirectly... but I want to clearly know "self" or "cloud", because license keys, URLs, etc. change all the time. In the future, maybe JW Player won't even require a license key for self-hosting... but self vs. cloud is a clear delineation that allows us to determine if Preset Sources should be an option.
As for not sure what to do when both are added, I'm assuming you mean existing users? I definitely think it should default to self-hosting. Anyone using cloud-hosting (today) is limited in what they can do... basically all the Drupal preset options are not used, and JW Player 7's configuration overrides everything. With self-hosting, we know that whatever Drupal presets are created will be honored.
Yes, exactly. Depending on the Preset Sources options selected, either the user gets the full Drupal preset experience, or can enter URLs to reference JW Player configurations. Maybe you're suggesting it would be better to have this as a toggle, where if a checkbox is selected, it switches between the Drupal-defined presets and the JW Player URL. Let me know your thoughts.
Good question. Would like to load it as a library, but there's something strange with
jw_player_ctools_export_ui_form
. The JavaScript was acting unpredictably... it would work correctly, then stop working. Didn't have this problem with other libraries, and no issue when we tried to attachjw_player.admin.js
as a library to other forms. Not sure if it might be something to do with the fact that it's a ctools hack.Comment #6
ron_s CreditAttribution: ron_s commentedOne additional comment about the idea of overriding cloud presets. The reason we created it the way we did is it would allow users to set up multiple cloud presets if they wish. For example, if users want a smaller "thumbnail" size player on Views that use a teaser view mode, a larger size player on full nodes, and want to host all of the configuration on JW Player, they can do so.
Just having an "override cloud presets" option won't allow this to work. I think if we wanted to have an override option, it should be an override to whatever the default is. We could take this type of approach on the preset forms, with just a radio button toggle, and the
#default_value
is based on what is set in the general settings:( ) Drupal-defined preset
(*) JW Player cloud-based preset
Player URL Library: ____________________________
Enter the URL to the player created on JWPlayer.com that contains the settings for this preset
==========================
(*) Drupal-defined preset
( ) JW Player cloud-based preset
Skin
[____________v]
Stretching
[________________________v]
[X] Autostart
[X] Use a Responsive Design
etc...
Comment #7
BerdirRight, that's pretty much what I had in mind. But for that, you don't need a global setting. That's something that you can and want to do per-preset.
Only suggestion on that would be to clarify in the description for the cloud based mode that providing a preset for the override is optional and it will use the global one by default. There is a default url, you're going to be using that for at least one of your presets I guess.
Comment #8
BerdirSome more things.
* The cloud URL validation fails on protocol-relative URLs (//content.jwplatform.com/libraries/...)
* is the skin really supposed to be the only thing shown when using cloud? why just that and not the other things?
* Based on what I wrote above, the library URL should be non-required for a preset.
Comment #9
BerdirAnd one more thing, sorry for the many comments.
As far as I see, the per-preset cloud URL isn't used yet? In 7.x, that's relatively easy to address, as you can add #attached js directly. But we do need to prevent that the global one isn't added.
In 8.x, it will be a bit more complicated, we'll have to register a library for each preset that uses a cloud-override and use that in place of the global one.
And because this wasn't enough fun yet. What happens if you mix multiple presets on the same page? One of the URL's will win then, so afaik, you can't have a big and some smaller players on the same page with cloud-based presets? Might be worth documenting the limitations somewhere.
Comment #10
ron_s CreditAttribution: ron_s commentedYes, there should be additional information in the description. Should also add a
#default_value
for this form field to be the cloud-based URL:Correct... we're already removing http/https on all URLs to make them protocol-relative, but need to address the case where users try to "outsmart" what JW Player provides and remove the http themselves.
No it shouldn't be there. I think that occurred from making the skin edits previously. It should be URL only on cloud-based, all fields on Drupal-based.
No it's not, that's why we're trying to implement these patches! :-)
Sure, but won't we address this in the next patch for the theme? Just trying to keep our work as focused as possible.
Yes, I would assume one of them is going to win. We'll add some documentation notes. We need to explain is if this use case is needed, developers should override all presets to use Drupal-based settings.
Comment #11
ron_s CreditAttribution: ron_s commentedAttached is a new patch for review. The only way to see the full picture is by combining patch #11 on "Improve formatter summaries" with this issue. That is what we have done in this version.
If you want us to try to split them again between the two tasks we can, but there's just so much change in the formatter functions due to the new
preset_source
field in the preset settings. Compare to the patch #11 on https://www.drupal.org/node/2713687 and you'll see the difference.Take a look and let me know your thoughts... I think we've addressed your previous comments in this thread. Thanks.
Comment #12
ron_s CreditAttribution: ron_s commentedHere are some images that show the different options in this patch. Let me know if you have questions.
Comment #13
ron_s CreditAttribution: ron_s commentedOne additional comment... my understanding had been that JW Player 6 does not support preset overrides for cloud like 7 does. Because of this, we disabled changing the option for legacy versions (see the picture). If this is not the case, let me know.
Comment #14
deanflory CreditAttribution: deanflory commentedI was successful in applying jw_player-preset_sharing_mute_validate-2713701-2.patch, but this was the resulting error after running update.php without the other patch further below because it failed to apply:
But, I just got this when trying to apply jw_player-refactor_theming-2713725-2.patch to jw_player-7.x-2.x-dev:
Just putting this here to make it easier to find via searches. Thanks for everyone's time and effort!
Comment #15
ron_s CreditAttribution: ron_s commented@deanflory, just mentioned on the other thread that these are a bit of work in process. Waiting for some feedback from @Berdir.
Also regarding this message:
I'm quite sure this is because of the way you applied the patch. Check to see if the file is located in a /theme directory at the root. When applying patches and a new file is created, it will be placed at the root if the command is run outside of the module directory.
Comment #16
ron_s CreditAttribution: ron_s commentedOne other comment... I wouldn't use patch #2 at this point. It's been hidden on this thread as an old version. #11 is the most current.
Comment #17
deanflory CreditAttribution: deanflory commentedNote that file is created here:
/.../sites/all/modules/jw_player/jw_player.theme.inc
but the error is looking for it here:
/.../sites/all/modules/jw_player/theme/jw_player.theme.inc
Comment #18
ron_s CreditAttribution: ron_s commentedI'm not having that issue, and it is correct at the top of the patch. The file is being created in "theme/jw_player.theme.inc":
Very last line is
create mode 100644 theme/jw_player.theme.inc
. That's correct.Comment #19
BerdirNice work. Applies fine here as well.
I've been wondering if it makes sense to allow overriding a local player with a preset.
You might end up with a locally loaded jw player and another cloud player JS file.
But I guess not a bigger problem than multiple cloud players. So, why not...
Hm, still not convinced that it is better to have this required with the default. It might not behave as expected when you change the default because the unchanged presets would still use the old default then. But if you change the default settings, you have to revisit all your presets anyway I guess.
Decided to commit this like this. We can open a new issue if we want to discus the preset cloud URL behavior. I could also imagine an explicit third option "Use default cloud settings" when using the cloud player.
PS: I managed to trick the validation by accidentally copying the license key into the cloud URL, then switch to local and save. Was confused when the cloud-preset default value was the license key. But I don't think that's worth to care about.
PPS: Would be awesome If you're interesting in porting those patches to 8.x after they are in. Could be a good opportunity to learn about D8 and I can help when you get stuck.
Comment #21
BerdirAnother thing that I forgot. We need to check if this needs an update function when we start to rely on thew new cloud/local variable and set it automatically, according to the existing settings.
Comment #22
ron_s CreditAttribution: ron_s commentedOverriding a local player with a preset is one of the core reasons why we're building these patches. Otherwise, the only option is to give developers/site builders access to the JW Player dashboard to create players. Since the JW Player dashboard also includes analytics and metrics similar to what someone might see in Google Analytics, there are some businesses who might not feel comfortable providing access to this information to staff.
Let's add a warning message: "Changing the existing URL will require review and updates to all existing presets that use JW Player as the source for preset information. Caution is recommended."
Simple enough to add some code to clear the other value when switched. We already started doing this for the width setting in presets, since it makes no sense to be at 300px when fixed, then switch to responsive and see 300%.
Yes, probably need to do a check for that. If you don't mind, I'll post these as a new issue. Thanks.
Comment #23
BerdirYes, new issue is fine.
Sorry, the first part was wrong/unclear. What I meant is overriding a local player with a *cloud* preset. But as I said, likely not weirder/more problematic than multiple cloud players.
Comment #24
BerdirSome improvements were also committed in #2713687: Improve formatter summaries.
Comment #25
BerdirAnd some more in #2725003: Remove remote Preset Source for JW Player 7 self-hosting.
Comment #26
johnchqueComment #27
johnchqueNot finished yet, but most of the port is done, need to fix the formatter summary for the image field.
Comment #29
johnchqueAdded working version, just realized that autoplay is not working, I will open a followup for it.
Comment #31
johnchqueFinally got a working version and it tests fixed.
Comment #32
johnchqueFixed some other things, now when no sharing site is selected all are selected by default. :D
Comment #33
johnchqueFollowup for fixing autostart created: #2767145: Fix autostart
Comment #34
Berdirwe have an entity in D8, so instead of passing in a preset machine name, we can make this a method on the entity.
Comment #35
johnchqueFunction moved. Also made some other small changes. :)
Comment #36
Berdirlets drop support for selecting 5.x completely in a separate issue.
As discussed:
* Drop the stored hosting setting, it just makes things complicated (update function, ..) and it's not used yet. we can still introduce it if we really need it but I doubt it
* Some more tests for the legacy vs. non-legacy conditions in the preset form and selecting some more options and making sure it shows up in the UI.
Comment #37
johnchqueAs discussed changes made. Follow up opened: #2769853: Remove Jw Player 5 support.
Comment #39
BerdirThanks, committed.