tmdb_v3-PHP-API- icon indicating copy to clipboard operation
tmdb_v3-PHP-API- copied to clipboard

Trailer in TV Show

Open ChrisTERiS opened this issue 4 years ago • 3 comments

Have copied the code below from Movie class to TVShow class and then I tried to display it on the page with $tvShow->getTrailer(); but nothing appear there. I know that this will (if) display only the filename, but is ok for me.

` /** * Get the TVShow's trailers * * @return array */

public function getTrailers() {
	return $this->_data['trailers'];
}

/** 
 * 	Get the TVShow's trailer
 *
 * 	@return string | null
 */
public function getTrailer() {
	$trailers = $this->getTrailers();

	if (!array_key_exists('youtube', $trailers)) {
		return null;
	}

	if (count($trailers['youtube']) === 0) {
		return null;
	}

	return $trailers['youtube'][0]['source'];
}

`

Maybe it needs to add somewhere append_to_response=video or something else? If yes, where is that declaration?

Thank you Chris

ChrisTERiS avatar Oct 25 '20 11:10 ChrisTERiS

@ChrisTERiS For TVShows you probably have more than one Trailer. Sometimes one for each season.

Added a getTrailers() to TVShows and extended the examples on my fork. Will create a merge request soon.

bogdanfinn avatar Oct 25 '20 12:10 bogdanfinn

@ChrisTERiS For TVShows you probably have more than one Trailer. Sometimes one for each season.

Added a getTrailers() to TVShows and extended the examples on my fork. Will create a merge request soon.

Yes, you're right. Don't remember if I read it at TMDb site but now except the "Trailer", have video types "Teaser" and "Behind the scene".

With my experience, I believe that the "Teaser" type is the good one if someone want to show just one video. Teaser is the global video for a TV Show while Trailers can be one per episode.

Thank you for your help. I'll wait the improved version.

ChrisTERiS avatar Oct 25 '20 15:10 ChrisTERiS

@ChrisTERiS For TVShows you probably have more than one Trailer. Sometimes one for each season.

Added a getTrailers() to TVShows and extended the examples on my fork. Will create a merge request soon.

Just seen in your link before that you had already post the changes. I did all the changes, except the one in configuration/all.php as video already exist as parameter at the end of the line.

Now the link to trailer works, but as I want to display it inline the page, I'll use $trailer['key'] for it.

Thank you so much for your help. Really appreciated !!

ChrisTERiS avatar Oct 25 '20 17:10 ChrisTERiS