alienlebarge
alienlebarge

Reputation: 3188

Do not show relative youtube video with TYPO3 ext:news

We are using ext:news for displaying youtube video on our intranet. enter image description here

The problem is that the default ext:news player show the relative video at the end. enter image description here

Is there a way to add rel=0 in the paramters without heavy modfications ?

Thanks for your help

Upvotes: 0

Views: 786

Answers (1)

Jost
Jost

Reputation: 5840

One way to do this (and I think the way EXT:news wants you to do this), is to provide a custom media renderer. However, you should first know how media rendering happens in EXT:news. The following text assumes version 3.0.1 of the extension.

How EXT:news renders media

EXT:news renders media by passing the media-object (an instance of Tx_News_Domain_Model_Media) to a list of media renderers. Each renderer tells the if it is capable of rendering the media element when it is asked. The renderers are asked in a given order, and the first one to answer "yes" gets to render the media element.

The renderers are simple classes which MUST implement the interface Tx_News_MediaRenderer_MediaInterface or Tx_News_MediaRenderer_FalMediaInterface (if you use FAL).

The described process for media rendering is triggered by using the ViewHelper <n:mediaFactory>. This ViewHelper gets 4 arguments:

  • The media element to render
  • The media renderer classes to ask (as a string of class names, comma separated)
  • The width and height of the media element

The interesting part is the "classes" argument of the ViewHelper. In the default templates it is set to the value of the TypoScript setting plugin.tx_news.interfaces.media.video, so you can also define the list in pure TypoScript, if you wish to.

What you need to do

You need to register your own media renderer object, which adds the "rel=0"-parameter to the used video URL. To do that, you need an extension, either an existing one you have control over, or a simple new one. This extension should provide a class that implements the Tx_News_MediaRenderer_MediaInterface interface and renders the video as you need it. You can probably copy almost everything from the class Tx_News_MediaRenderer_Video_Youtube.

Then you need to add the name of that class to calls of the <n:mediaFactory>-ViewHelper, e.g. by adding it to the mentioned TypoScript setting. Make sure that it either replaces the default Youtube MediaRenderer, or comes before it in the list.

Upvotes: 1

Related Questions