Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2018-04-22 09:16:39

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

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

Sorry, I am not a programmer, and can not find any way by coding HTML and CSS. .Oui\Player\youtube{} is invalid in CSS language, and .youtube{} do not work, too. When I set own class="player", the plugin distorts webpages with unclosed <div>:

<div class="player"><txp:oui_player provider="youtube" play="vXo_QN5cYhE" /></div>

becomes

<div  class="Oui\Player\youtube" /> 
 <div class="player"><iframe width="580" height="326.25" src="//www.youtube-nocookie.com/embed/vXo_QN5cYhE?autohide=1&amp;cc_load_policy=0&amp;iv_load_policy=3&amp;rel=0&amp;showinfo=0&amp;theme=light" frameborder="0" allowfullscreen></iframe></div>

— with additional div.

Last edited by Vienuolis (2018-04-22 09:23:23)

Offline

#38 2018-04-22 09:29:26

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,223
Website

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

Vienuolis wrote #311310:

Sorry, I am not a programmer, and can not find any way by coding HTML and CSS. .Oui\Player\youtube{} is invalid in CSS language,

It is valid HTML though…

If you have to use that class, escape the \, like so (CSS 2.1 c4 stuff):

.Oui\\Player\\Youtube { border: 10px solid red;}

Or attribute selectors are your friend: div[class*="Youtube"]

I agree that those generated classes are a bit odd though.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#39 2018-04-22 09:43:34

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

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

phiw13 wrote #311311:

It is valid HTML though…

Yes, valid, but it changes all remained page structure with no closing </div>

.Oui\\Player\\Youtube { border: 10px solid red;}...

Helped, thank you very much!

Or attribute selectors are your friend: div[class*="Youtube"]

Perhaps the older browsers could not understand…

Offline

#40 2018-04-22 14:19:03

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

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

I have fixed media, embedded via custom field only. While media provider or sizes are not default, the extra not ending div appears, though. It appears even if there is no txp:oui tag at all — when media is embedded via original iframe! Although divs are not doubling and webpage is not distorting by other embedded txp:oui media, followed after default video, inserted via custom field.

After some research and test, I finally found a pest — <script src="https://platform.vine.co/static/scripts/embed.js"></script>, inserted at the end of a webpage. When I switch TxP form from my media template to another one, doubled <div class="Oui\Player\Youtube"> leaves out.

Offline

#41 2018-04-23 15:48:42

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

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

Vienuolis, the Vine script should not be embed but this was fixed, at least in the dev branch.
However, it should not cause your issue.
About the example provided here, I can’t see how the tag could add a div around the one you code manually (the one with the “player” class)… that is really weird!
Anyway, I can’t reproduce ; do you use the last version?


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

Offline

#42 2018-04-23 17:11:55

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

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

Oh, overlooked, sorry. I have upgraded now to the latest 1.3.1 version (was v1.3.0), and not-ending <div> is remained, though. Only when custom field for media is empty — in case of non-default size or provider. When custom field for media is filled in, even subsequent iframe and its wrap tags are correct and clear. Former class Oui\Player\Youtube gone away, now it is replaced with designer-defined word.

Edit: Vine script remained, too.

Last edited by Vienuolis (2018-04-23 19:08:28)

Offline

#43 2018-04-24 07:14:59

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

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

Vienuolis wrote #311336:

Oh, overlooked, sorry. I have upgraded now to the latest 1.3.1 version (was v1.3.0), and not-ending <div> is remained, though. Only when custom field for media is empty […]

I’m not able to reproduce — I would be curious to see your code — but you should test the custom field, otherwise it will through an error in debug mode if it is empty.

<txp:if_custom_field name="video">
    <txp:oui_player />
</txp:if_custom_field>

I will maybe include this test in the oui_if_player tag in the future to perform more tests with less code.

Edit: Vine script remained, too.

Ok, It will be removed in the next version.


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

Offline

#44 2018-04-24 08:56:12

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

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

An essence of my txp:article form=“filmai” (films, videos):

		<txp:if_article_list>
...
		<txp:else />
	<dfn class="apie"> <txp:if_description>
<txp:meta_description format="" />.<br /></txp:if_description>
<txp:author link="1" />, <txp:posted />.</dfn>
	<div id="esme">
<h1><txp:title /></h1>
	<txp:oui_if_player>
<txp:oui_player wraptag="div" class="grotuvas" /> <txp:else />
<txp:cfm_videoplayer fieldname="audio-video-vieta:" width="580" height="439" frontcolor="#003300" backcolor="#EEEECC" screencolor="#EEEECC" lightcolor="#009900" class="grotuvas" />
	</txp:oui_if_player>
<txp:body />
<txp:article_image class="vaizdas" html_id="gale" />
	</div><!-- esmė -->
	<dl id="rekvizitai"> ... </dl>
	<p id="galas"> ... </p><!-- galas -->
<txp:output_form form="disqus_talka" />
		</txp:if_article_list>

And a typical txp:oui_player string in an article body, while video is not in default HD format:

<txp:oui_player provider="vimeo" play="227711628" width="580" height="435" wraptag="div" class="grotuvas" />

Interesting: the same strings are converted to iframe correctly, without duplicating divs, while they are following the default video, defined in its custom field (named “audio-video-vieta:”).

An index of video articles is here: on.lt/filmai/

A default video article looks like on.lt/lietuviu-tautos-kilme-2018

A default article with supplementary non-default videos are also shown correctly: on.lt/aerobatika-trio

Only non-default articles with an empty custom field appear with duplicated outer non-ending div, witch I must append with additional </div> every time (in an article body, not a form): on.lt/dangaus-sodai

Offline

#45 2018-04-24 09:41:20

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

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

Vienuolis wrote #311354:

Only non-default articles with an empty custom field appear with duplicated outer non-ending div

Thanks Vienuolis, that is related to what I said before about testing the custom field; oui_if_player can’t work with an empty value for now.
Please try to replace the oui_if_player function with the following, it should avoid you to add a if_custom_field tag:

    function oui_if_player($atts, $thing)
    {
        global $thisarticle, $oui_player_item;

        $player = 'Oui\Player\Main';
        $obj = $player::getInstance();

        // Set tag attributes
        $get_atts = $obj->getAtts(__FUNCTION__);
        $latts = lAtts($get_atts, $atts);
        extract($latts);

        $field = get_pref('oui_player_custom_field');

        if ($play && isset($thisarticle[$play]) && $thisarticle[$play]) {
            $play = $thisarticle[$play];
        } elseif (!$play && isset($thisarticle[$field]) && $thisarticle[$field]) {
            $play = $thisarticle[$field];
        } else {
            $play = false;
        }

        if ($play) {
            // Check if the play attribute value is recognised.
            if ($provider) {
                $player = 'Oui\Player\\' . $provider;
                if (class_exists($player)) {
                    $obj = $player::getInstance();
                } else {
                    trigger_error('Unknown or unset provider: "' . $provider . '".');
                    return;
                }
            }

            $obj->play = $play;
            $oui_player_item = $obj->getInfos();

            $out = parse($thing, $oui_player_item);
            unset($GLOBALS['oui_player_item']);

            return $out;
        }

        return parse($thing, false);
    }

I will include this in the next version.

Last edited by NicolasGraph (2018-04-24 12:29:23)


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

Offline

#46 2018-04-24 10:39:32

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

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

Sorry, I am not a programmer, thus even do not know where and how to insert you code ;-)

Anyway, there is not a problem now, when I know what happen. On.lt is not very intensive publication, there is not difficult to append non-default string with an ending </div> for now.

I have switched production status to “Debugging”, and did not found the error message for an empty field. A non-default video article is parsed as follows:

| <txp:article form="filmai" limit="99" />
| 	[filterAtts ignored]
| 	[SQL: SELECT Form FROM txp_form WHERE name = 'filmai' ]
| 	[Rows: 1]
| 	[Form: 'filmai']
| 	[Nesting forms: 'filmai']
| 	<txp:if_article_list>
| 		[<txp:if_article_list>: false]
| 		<txp:if_description>
| 			[<txp:if_description>: true]
| 			<txp:meta_description format="" />
| 		</txp:if_description>
| 		<txp:author link="1" />
| 		<txp:posted />
| 		<txp:title />
| 		<txp:oui_if_player>
| 			[<txp:oui_if_player>: true]
| 			<txp:oui_player wraptag="div" class="grotuvas" />
| 		</txp:oui_if_player>
| 		<txp:body />
| 			<txp:oui_player provider="vimeo" play="22202388" width="580" height="435" />
| 		<txp:article_image class="vaizdas" html_id="gale" />
| 			[SQL: SELECT * FROM txp_image WHERE id = 272 ]
| 			[Rows: 1]
| 		<txp:if_excerpt>
| 			[<txp:if_excerpt>: true]
| 			<txp:excerpt />
| 		</txp:if_excerpt>
| ...
| 	</txp:if_article_list>

What the statement oui_if_player means — existence of the defined video? Defined in both custom field or in an article body, nevermind?

Offline

#47 2018-04-24 10:56:18

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

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

Vienuolis wrote #311358:

Sorry, I am not a programmer, thus even do not know where and how to insert you code ;-)

Just click the plugin name in the Plugins tab, then click the textarea, find the oui_if_player function (cmd/Ctrl+f), replace the whole function with the provided code and save.
I’m working on a version 2 but I need more time to get it work well, if I can’t publish it soon I’ll release a v1.4 including last fixes.

What the statement oui_if_player means — existence of the defined video? Defined in both custom field or in an article body, nevermind?

It should check the video provider/URL provided through attributes or prefs against defined values/schemes. It fails in our case because of the empty field.


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

Offline

#48 2018-04-24 10:58:42

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

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

Vienuolis wrote #311358:

I have switched production status to “Debugging”, and did not found the error message for an empty field.

Yes, I didn’t know/notice you were using the oui_if_player tag around oui_player when I mentioned this error message.


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

Offline

Board footer

Powered by FluxBB