Textpattern CMS support forum

You are not logged in. Register | Login | Help

#71 2018-07-25 15:32:36

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,065
Website

Re: oui_player (formerly oui_video) - Easily embed customized players

Thanks for the pointer to your shorttag, Yiannis.

Yes, the idea would be, like yours, to not start any interaction with vimeo (or whatever) until the user has either globally given consent (general cookie consent), or decides to override his or her decision to decline consent to see a particular video.

To make that choice (“am I interested in this video?”) a visitor will want to see some idea of what the video is about, otherwise the videos are essentially ‘redacted’ out of the website and are only present as a meaningless link. I think that’s in effect punishing users for opting for personal privacy. And the site owner’s will not be happy to see ‘holes’ in place of what they hoped would be dynamic, compelling content.

In your version, you tackle that by describing what the video contains in words. That’s a valid approach but means more work for site authors. In my case, I’m reworking a site in a language I don’t speak, so I can’t do that myself. The site authors won’t be happy if I tell them they need to provide text descriptions for all their videos.

The intention behind my idea is to pre-fetch the cover images as the site admin when saving the articles, then to show the pre-fetched cover image with a play button and notice to users who have opted out. The end result would be:

  • The site authors’ site looks pretty much the same as it did before
  • The visitors’ experience of the site is similar with two small differences:
    • they don’t reveal themselves to vimeo unless they choose to click and play.
    • there’s an additional notice alongside the play button.

As the cover image was already defined by the video author, so the site authors have no extra work.

Nicolas, what do you think? Is that do-able?


TXP Builders – finely-crafted code, design and txp

Offline

#72 2018-07-26 09:28:06

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

Re: oui_player (formerly oui_video) - Easily embed customized players

jakob wrote #313128:

  1. Is it possible to retrieve the respective vimeo video’s aspect ratio? The site I’m working on currently uses a custom field to set widescreen or not in a custom field, e.g. requires user input, but I wonder if that can now be automatically discovered.

Unfortunatly, it can’t be as for now. To easily embed customized players in the fastest way, oui_player does not use any provider API. Using oembed (it is what is ussually proposed) would permit this kind of thing but would also hit the performance because of the external queries.
I think to add a way to smartly manage providers API for some time, but it still needs some thinking.

I’m facing the same problem of what to do when a user denies cookies / privacy settings and saw your comment here which suggests you may be adding the possibility to “view on cookie consent”. I can, of course, wrap the entire tag in a oui_cookie tag and simply not show the video at all, but I wondered if you’d come up with a better alternative.

I’m afraid that you need to wrap the entire tag for now.
In fact, in parallel of the oui_cookie development, I recently worked on a more generic plugin alternative named oui_globals which is now able to manage $_GET, $_POST, $_COOKIE and $_SESSION. It is during this plugin development that I played with global attributes such as if_cookie. While this plugin base seems to work it still needs to be documented and in theory if_cookie should be named oui_if_cookie. But, anyway, this global attribute would not let you choose an alternative content. To use an else condition you would still need to wrap the entire tag.

I haven’t found a nocookie link for vimeo videos like there is for youtube […]

Yes, I don’t think Vimeo provide this kind of URL.

[…] so my preference would be to show the vimeo cover image with a click at the moment the page is viewed also sends the user’s browser details to vimeo.

An idea: might it be possible to add a function that hooks into the article_save callback, reads out the video “play” id from the video field (as specified in oui_player prefs) and caches the cover image as a file in the local installation, e.g as the vimeo ID# prefixed with the video-service for later use? In the case of vimeo, the cover image can, I believe, be legally retrieved from an XML file with the video’s ID (as described here). By caching it when saving and then using that image for the “cookie-safe” preview, the user’s browser would only need to make contact with vimeo when the user actually clicks to view.

As I previoulsy said, oui_player does not use any API such as the Vimeo one you mentioned (for Youtube and Dailymotion I could add thumbnails like drmonkeyninja in his cakephp-video-helper as image URL’s are predictable).
Your idea to get and save or cache the content provided by an API on saving is interesting, but I guess it should also work when the play attribute is not provided through a field (e.g. video embed in a page or a form). Let me think about that, but do not expect this kind of feature very soon.

Last edited by NicolasGraph (2018-07-26 09:32:39)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#73 2018-07-26 20:54:07

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

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.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#74 2018-07-27 08:04:18

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,065
Website

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

#75 2018-07-27 09:42:05

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

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)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#76 2018-07-27 11:09:03

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

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. as vimeo_{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)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#77 2018-07-27 15:44:14

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 617
Website

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&amp;hide_related=true&amp;show_artwork=false&amp;show_comments=false&amp;show_reposts=false&amp;show_user=false&amp;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, though only when there’s gravity.

Offline

#78 2018-07-28 10:56:35

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

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.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#79 2018-08-10 16:01:26

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

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.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#80 2018-08-10 16:05:25

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 858
Website

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)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

Board footer

Powered by FluxBB