Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
oui_player (formerly oui_video) - Easily embed customized players
Easily embed customised players.
This plugin does, by its own, what arc_youtube, arc_vimeo and oui_dailymotion used to do together.
It also adds a support for other providers such as Myspace videos, Soundcloud, Mixcloud, etc. and is coded to be easily extended.
Plugin preferences define most of the attribute default values, making things easier for site users.
Requires Txp 4.6+
Examples
Display a video
Use your favourite provider and the video related custom field as set in the plugin prefs.
<txp:oui_player /> // Yes, that's it!
Use a video id through the tag attribute.
<txp:oui_player provider="dailymotion" play="x4l8awd" />
Let the plugin find the provider and the video id by providing the video URL.
<txp:oui_player play="https://vimeo.com/155020267" />
Using the conditional tag
<txp:oui_if_player play="https://vimeo.com/155020267">
Yes, it is a valid video URL scheme.
<txp:else />
No…
</txp:oui_if_player>
…or with the provider attribute…
<txp:oui_if_player provider="vimeo" play="https://vimeo.com/155020267">
Yes, it is a valid Vimeo URL scheme.
<txp:else />
No
</txp:oui_if_player>
Last edited by NicolasGraph (2017-07-01 07:24:35)
Offline
#2 2016-09-01 06:30:27
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: oui_player (formerly oui_video) - Easily embed customized players
Very useful.
I guess I can use a custom field filled with the video ID number.
It would be nice a dropdown menu to choose the preferred provider: is could be possible in someway to get this in the original Txp interface?
Last edited by candyman (2016-09-01 06:31:44)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
candyman wrote #300904:
Very useful.
Indeed!
… could be possible in someway to get this in the original Txp interface?
I guess the problem here is that the API of third party providers (youtube, vimeo, etc) may change which might make txp incompatible. Furthermore, the rumours are that the next mac OSX will not support flash by default or even quicktime. What seems that they are thinking is closing the system similarly to the IOS paradigm.
As much as I like embedding videos, I think that a plugin is the way to go.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
candyman wrote #300904:
Very useful.
Glad you like it!
I guess I can use a custom field filled with the video ID number.
Yes, you can!
I’m now wondering if I wouldn’t remove the custom
attribute to use the video
attribute only (video=“custom1”). There would be a really tiny chance that your custom field have the same name as the video id you want to use and in this rare case you could still use video='<txp:custom_field name="custom1" />'
.
It would be nice a dropdown menu to choose the preferred provider.
It would require to change few things but I’ll take a look at this.
Offline
#5 2016-09-01 09:51:21
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: oui_player (formerly oui_video) - Easily embed customized players
Great. Actually I have a two custom fields where I put the IDs of youTube videos (one for 4:3 and one for 16:9 that use different CSS layout): it could be possible to add a dropdown menu for the aspect ratio too?
The ideal would be a custom field (Video ID) and then a collapsable option menu where, if opened, you can specify other options using dropdown menus (one for the provider and one for the ratio). You should have the possibility to specify default options (es: Youtube@16:9) in a dedicated plugin option tab.
Just an idea.
Last edited by candyman (2016-09-01 09:57:34)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
candyman wrote #300910:
Great. Actually I have a two custom fields where I put the IDs of youTube videos (one for 4:3 and one for 16:9 that use different CSS layout): it could be possible to add a dropdown menu for the aspect ratio too?
The ideal would be a custom field (Video ID) and then a collapsable option menu where, if opened, you can specify other options using dropdown menus (one for the provider and one for the ratio). You should have the possibility to specify default options (es: Youtube@16:9) in a dedicated plugin option tab.
Just an idea.
Options probably won’t take place in the Write tab. The only thing I can do for now is to add plugin prefs to choose some attribute default values. I already have a working version with plugin prefs for the custom field and the provider by default…
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
NicolasGraph wrote #300892:
This plugin does, by its own, what arc_youtube, arc_vimeo and oui_dailymotion do together.
You can easily embed videos with customized players from Youtube, Dailymotion and Vimeo.
A brilliant little plugin that goes a way towards making things easier.
candyman wrote #300910:
It would be nice a dropdown menu to choose the preferred provide: is could be possible in someway to get this in the original Txp interface?
You could do this a different way. I have a custom field called article_video
in one of my sites that holds the video infos in the form service:idnumber
.
You can then use smd_wrap or similar to split that apart to get at the individual parts:
<txp:variable name="video_service"><txp:smd_wrap transform="split|:||1"><txp:custom_field name="article_video" /></txp:smd_wrap></txp:variable>
<txp:variable name="video_id"><txp:smd_wrap transform="split|:||-1"><txp:custom_field name="article_video" /></txp:smd_wrap></txp:variable>
which you can then use to construct your video embeds – or plug into Nicolas’ plugin with:
<txp:oui_video provider='<txp:variable name="video_service" />' video='<txp:variable name="video_id" />' />
TXP Builders – finely-crafted code, design and txp
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
candyman wrote #300910:
Great. Actually I have a two custom fields where I put the IDs of youTube videos (one for 4:3 and one for 16:9 that use different CSS layout): it could be possible to add a dropdown menu for the aspect ratio too?
Perhaps try this extending the above principle:
- Set up a single custom field called, for example
article_video
. - Put your details in like this service#video-id@16:9.
To get at the individual parts do:
<txp:variable name="video_service"><txp:smd_wrap transform="split|#||1"><txp:custom_field name="article_video" /></txp:smd_wrap></txp:variable>
<txp:variable name="video_id"><txp:smd_wrap transform="split|#||-1,split|@||1"><txp:custom_field name="article_video" /></txp:smd_wrap></txp:variable>
<txp:variable name="video_ratio"><txp:smd_wrap transform="split|@||-1"><txp:custom_field name="article_video" /></txp:smd_wrap></txp:variable>
While I’ve not tested this, it should:
- Split the string at the # and get the first part = txp variable
video_service
- Split the string at the # and get the last part, then split that at the @ and get the first part = txp variable
video_id
- Split the string at the @ and get the last part = txp variable
video_ratio
Note: I suggest switching to using a # as separator (compared to the post above) as the ratio includes a : in it.
TXP Builders – finely-crafted code, design and txp
Offline
#9 2016-09-01 13:32:21
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: oui_player (formerly oui_video) - Easily embed customized players
Many thanks Jacob.
Never used smd_wrap but I could try following your tips.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jakob wrote #300917:
A brilliant little plugin that goes a way towards making things easier.
Thanks jakob!
…You can then use smd_wrap…
Good tip; rah_repeat could also do the job.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
NicolasGraph wrote #300921:
Good tip; rah_repeat could also do the job.
That’s a good idea and would make it even easier!
If you used the same delimiter between your video details, e.g. commas, for example:
service, video-id, 16:9
then all you would need to get the three variables is:
<txp:rah_repeat value='<txp:custom_field name="article_video" />'
assign="video_service, video_id, video_ratio" />
That makes a txp variable out of each of the values in your custom field. As rah_repeat also automatically trims off white space, it should be forgiving about spaces after commas.
TXP Builders – finely-crafted code, design and txp
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
You can now oui_video v0.1.0-beta-2. Thanks for your feedbacks.
Offline