Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: oui_player (formerly oui_video) - Easily embed customized players
In fact, Vimeo seems to also have predictible thumbnail URL’s: https://i.vimeocdn.com/video/[ID]_[width].jpg
… However the image height is variable.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
Thanks for your feedback Nicolas!
NicolasGraph wrote #313143:
In fact, Vimeo seems to also have predictible thumbnail URL’s:
https://i.vimeocdn.com/video/[ID]_[width].jpg
… However the image height is variable.
Yes, it was something like that I was thinking of, except that the the [ID]
in your link above is not the same as the video ID. If we take your example above of:
https://vimeo.com/155020267
and do the following to get the image:
https://i.vimeocdn.com/video/155020267_640.jpg
we get a different image. You have to retrieve:
http://vimeo.com/api/v2/video/155020267.xml
which you can download directly without an API key or anything, and you get a small XML file with the video metadata including the following three entries:
<thumbnail_small>https://i.vimeocdn.com/video/682183460_100x75.webp</thumbnail_small>
<thumbnail_medium>https://i.vimeocdn.com/video/682183460_200x150.webp</thumbnail_medium>
<thumbnail_large>https://i.vimeocdn.com/video/682183460_640.webp</thumbnail_large>
Note the ID number is different. It’s not the same as the video. Sometimes the files are also .png files. I have no idea if there’s an algorithmic connection between the thumbnail ID and the video ID that one could use to bypass reading the XML file to get the URL.
My ‘idea’ was to use your video ID detection algorithm from oui_video from within a function that hooks into the article_save
callback (or whatever the right callback is when saving an article) and saves the images to a folder (or the DB), e.g. as vimeo_{videoID}_{size}.{ext}
.
Then when you come to embed the video for ‘non-cookie users’ (or everyone if you prefer), you show the image, overlay a play symbol and privacy notice. For users with activated js, clicking would embed the iframe as you have it now and play the video. For users without activated js, it would just be a link the vimeo URL opening in a new window. A visitor would therefore not ‘expose themselves’ to vimeo until the click to play but their viewing experience would be largely unchanged.
Incidentally, I just noticed the XML file also contains the video size details from which the video’s aspect ratio could be deduced:
<width>1280</width>
<height>720</height>
TXP Builders – finely-crafted code, design and txp
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jakob wrote #313148:
Yes, it was something like that I was thinking of, except that the the
[ID]
in your link above is not the same as the video ID. […]
Oh, yes, you are right image ID’s are definitly not the same as video ones !
For the rest of your issue/suggestion; I know that API’s provide more useful informations than what you can get from my plugin. My only “shyness” (is google translate right?) is about perfs without cache.
In fact I use the Instagram API in oui_instagram
; I needed to add a custom cache system first and then I aborted it, suggesting users to play with aks_cache
because of the extra work it required – and in fact, imo, it was kind of “out of feature” anyway. So, I think I will add available API’s support in the future but probably no related storage system. However, depending on how I will proceed, I will consider to add the kind of callbacks you smartly suggested.
For now, here is how I see the future: I will first try to use the API only to guess the player size if two dimensions related values (width, height, ratio) are missing in the prefs/attributes. Then, I will add other features related to API’s contents (I need to see how consistent they are). I guess it will be part of the v3? What do you think?
Edit: sorry, I’m slow today… would you like the callback providing the media ID first? It could be not so long to come. End of the month august I guess.
Last edited by NicolasGraph (2018-07-27 10:12:54)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
…definitly slow…
jakob wrote #313148:
My ‘idea’ was to use your video ID detection algorithm from oui_video from within a function that hooks into the
article_save
callback (or whatever the right callback is when saving an article) and saves the images to a folder (or the DB), e.g. asvimeo_{videoID}_{size}.{ext}
.
In fact, you just want to know how to get the video ID from the custom field value, right?
I will publish a new version in august; variable/methods naming and code documentation will be improved. At the end, you should be able to do something like so:
\Txp::get('Oui\Player')->setMedia($value)->getMediaInfos();
I would like to tell you that it will be online sooner but I leave in two days… Few chances I find the time to finish.
Edit: Also, I don’t know if it fit your needs but the oembed API (the one I will probably support) works with a video URL and includes some video thumbnail related informations.
Last edited by NicolasGraph (2018-07-27 12:37:43)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
Hi Nicolas, am a great fan of your plugin, thanx for doing this.
I installed all new versions for 4.7.1 with all separate plugins.
How can i have oui_player always guessing the nature of my link (from custom field), as it was before?
Currently i am using something like
<txp:oui_if_player play='<txp:custom_field name="release_audio_1" />'>
<txp:oui_player class="player" />
</txp:oui_if_player>
but the player
• doesn’t show other than in the page source, more importantly though
• it uses the preference from favourite provider to construct it’s player link,
• and the class attribute is not being recognized.
Resulting into something like this
<div style="position: relative; padding-bottom:0px; height: 0; overflow: hidden"><iframe src="//w.soundcloud.com/player/?url=https://soundcloud.com/danielweltlinger/ndr-kultur-weltlinger&hide_related=true&show_artwork=false&show_comments=false&show_reposts=false&show_user=false&single_active=false" style="border: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%" allowfullscreen></iframe></div>
Can the player only rely on guessing and show the class?
Thank you in advance!
Last edited by jayrope (2018-07-27 16:54:04)
A hole turned upside down is a dome, when there’s also gravity.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jayrope wrote #313157:
Can the player only rely on guessing and show the class?
It should.
HI jayrope,
sorry, I’m not able to take a deeper look into your issue for now, and I won’t be able the next few days.
The player is not displayed because of the padding-bottom: 0px
. This style attribute is related to the responsive feature but should not be set to 0.
Also, I guess that there could be a problem with the play
attribute inheritence. If you can pass its value again in the oui_player
tag it could maybe fix the wrong provider.
Could you let me know a value which gives you this kind of result so I will test when possible?
Thanks.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jakob,
if you are still interested in, I just reworked the plugin to introduce a callback event allowing to manipulate media related informations on each rendered player. I also added a player preview under the plugin preference related article field, so you could use its callback event in the admin.
Here are the callback related data inspired by oembed API’s for now:
array(
'provider_name' => 'Vimeo',
'type' => 'video',
'parameters' => array(
'autoplay' => 1
),
'width' => 640,
'height' => 360,
'responsive' => false,
'media' => array(
'https://vimeo.com/59777392' => array(
'id' => '59777392',
'uri' => '59777392',
'pattern' => 0,
)
)
);
The media id
and uri
may change from one provider to another.
It seems to work but I will need to perform more tests next week as the code changed more than I expected since the last Bêta release date. I will try my best to avoid regressions.
If you are thinking about any other useful information to add, please let me know.
I’m thinking to introduce avilable oembed API’s in the next major release.
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jayrope,
Sorry for the delay; your code just seems to work fine in my last code rework.
I will try to through a new pre-release next week.
Feel free to send me more cases to test in the meanwhile.
Last edited by NicolasGraph (2018-08-10 16:05:36)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
FYI, oui_player, oui_provider and all related extensions (except oui_vine but including new oui_ted and oui_spotify extensions) have just been released to new Bêta versions.
pluggable_ui() is now used to alterate the plugin output and, for example, facilitate the replacement of a player with an image depending on whatever condition, as Julian asked for.
Here is a Vimeo related basic example to get the right player ratio from the provider oembed API and replace the player with its related thumbnail if the cookie-consent
is not set.
# Name: oui_vimeo_plug v0.0.1
# Replace the oui_vimeo player…
# Author: Nicolas Morand
# URL: http://github.com/NicolasGraph
# Recommended load order: 5
# .....................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the "Install plugin" box:
# .....................................................................
H4sIAAAAAAAAE41W/W7bNhD/309xE7JKzhzLrusskeJsQzNsRZel2Lr90wUCLdEWG0oUSMqu
UQToQ+wZ9mB9kh1JSf5Ilk5AYup0X7/f3ZEk0XgSfVTRi8grSUG9WEVjXIuaJStWUJFUvF4a
6beRt6JSMVGat2nkjYaj4disTyOP1DoXsjX+laWCEwXXQpIys9JRq5PUkhnJBCW51lUUhkum
83o+TEURNpY/SVLl1m4ceRlVqWSVbiJPUPQbrThJKeicQpcpoGxD5edP/xg1TCOnvDJLjNRI
UpE5hOfnCKfXM4hVZTzd1Czu9VKMreBP4+0Nwu597AE+4fGx/YVjeClKpWWdaiGHjSzs2UVV
zzlLYVGXqckUkiRtdYO+1XDOzCPpkilNZZISzuckvQuIlGQTHOmcqQH4kpYZlX4flwadw+Xj
m8Xp92Pr6b53mN0fylFiAYCgxZxm8MObV6AFYKi05kQ7DecScsqWuYaFFIUTS7FiGRqtWaZz
wOK1rmXDOCk3aOywKlRtYjX+1lhJYFqhugmVodO6mJeEcWALG8FPhbhj9MSQQ0vtg3sHpqAU
GhTVcROyjfx9RSQp4IiutGOvJa0LQlfoCT5/+hsKYmg1CS5ZCaa68aEbpav/cIOmlfXSsCAf
d5ARTazoLcJJa4nF0nwDrmasXDZcPLBj2A2kRAp37Fre2m/DzkhSXcsSc7Iuf357/cvT7ebC
B4algQU5cJkOtoEPu/DINciVwTOD90qUSUbNhAQLxmmypNq0sMY0VeA3o2ob0E4qqVjoHAyN
6Xe15DMfhiDJGpe0tI662CeX6O6aZowEfXzibRIZKxSG39e8QmHwtJZqtDqdTu+db7vXvx1A
GMJrilU9oNt+H+5ZLghX1BpcMUXmnDazsa+1Q9nJpZuRIfiRwb33ydlad79TbRtfEqzTdtKa
4ezm7PFwDo7EPQrHha2of9tB0jtdtFWAFeE13Xrp79HZiXEYA/2hYlhduTBjPZvNwHc95cOz
Z/AVU0hwcJS8vLl5/erHd4dje9vv73RS6/KRfA/VHCzXcv5FxlbY4htOZ14lFDOdHLl5ROMY
KpJl2P4nc6G1KBzNLoRjC+lA+uOGuwhGMQg8oxZcrCPIWZbR0rs0ViUMH2RhHt/8u2DFEpRM
Z55RrXBzTprdLvDD5K/sm9Bsvfi3V+JuZ8MDjfdNHt5DKGSuBK81QtGisvlxunCJ2spHMB6N
vt4CMG9fyPgiRNIu/Xjv6z1QbN8nqf5fIJMdirsh+hLsB8n0nkyrTWl/4s0Otzvx99tmbbZC
a9eefPi5pOvtSR33mhNebyp3wkfetLmnCIk744FswclS7dwNztCSftB4FbjbkY5RE08JsU5y
XfDE3SdYNDa3kMgrMutt8jzyTueT+SKbjhZ0epZROpmSsxGZjk/pdPp88uIcr0D3/wKE68T2
aAkAAA==
Edit: the responsive rendering related preference is now provider related. If you are updated from a previous Bêta version, the providers related pref will be added at last. You can delete and re-install extensions to get this pref just under the ratio related one, but in this case, all the provider related preferences will be reset to their initial values.
Last edited by NicolasGraph (2018-08-15 15:16:49)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
Thank you Nicolas! I’ve not tried it out yet (was pleased to get the other method working so I’m not going to rock that just yet) but it’s great that you’ve made this possible. I’ll certainly examine it. It would be great to be able to present audio-visual content without necessarily clobbering viewers with trackers when one doesn’t even view or listen to it.
TXP Builders – finely-crafted code, design and txp
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jakob wrote #313452:
[…] (was pleased to get the other method working so I’m not going to rock that just yet) but it’s great that you’ve made this possible. I’ll certainly examine it.
You would mainly need to add the CSS+javascript part, as I didn’t work on that.
It would be great to be able to present audio-visual content without necessarily clobbering viewers with trackers when one doesn’t even view or listen to it.
Indeed, it would, I’ll investigate on a way to do it.
Last edited by NicolasGraph (2018-08-16 13:16:38)
Offline
Re: oui_player (formerly oui_video) - Easily embed customized players
jakob,
FYI, I’m updating Vimeo player parameters and the dnt
parameter may interest you.
We track all playback sessions to identify bugs and monitor performance in our player. Setting this parameter to true will block the player from tracking any playback session data.
Offline