Jump to content

Video Fieldtype


adrian
 Share

Recommended Posts

  • 2 weeks later...
  • 5 months later...

Struggling with page reference inside repeater

Hi,
since the video files are usually bigger then some jpgs, I wanted to reuse uploaded video files on a website.

There is a page reference field select_video inside a repeater. The file field for the videos is video_field.
In a hidden page "video-container" are hidden child pages. Each child pages has a single video. I want to show each video via the page reference (inside a repeater) on a different page.
In the field video_field under Basics -> Type the option Files is active. 
 

This is my code, where only headline and body_second are rendered.

<? foreach ($page->repeater_headline_movie_text as $item) : ?>
					<h3><?= $item->headline; ?></h3>
					<article class="video_article">
						<?php if ($item->select_video->id) : ?>
							<?php $file = $item->video_field;
								if($file) {
  								echo "<video width='{1280}' height='{710}' poster='{$file->video_field->poster}' controls='controls' preload='yes'>
									<source type='video/mp4' src='{$file->video_field->url}' />
									<track kind='subtitles' src='{subtitles}' srclang='de' />
								</video>
							";
								} ?>
						<?php endif; ?>
						<div class="textwrapper">
							<?= $item->body_second; ?>
						</div>
					</article>
				<? endforeach; ?>

 

Link to comment
Share on other sites

At a quick glance, it feels like you are missing a level when getting the video. You need to get the video_field from the select_video, but instead you are getting video_field from $item. Does that sound right?

 

Link to comment
Share on other sites

1 hour ago, adrian said:

At a quick glance, it feels like you are missing a level when getting the video. You need to get the video_field from the select_video, but instead you are getting video_field from $item. Does that sound right?

 

Hi Adrian,

thanks for your suggestion. Yes, now I see what's missing. The logic must be:
Select the page, check if there is a field video_field inside and render the content.

And I think that this php-logic causes me headache ?

 

Link to comment
Share on other sites

  • 1 month later...

Hello
I am trying to use this module on a site. And I am getting the following error when trying to add a video to a page.

 - Param given by constructor is not valid gd resource

Any clue what this is?

[UPDATE]

I replace the content of the folder ffmpeg-php inside the module, for a recent version of this library, and this solve that issue.

And edit the line 114 of the file InputfieldVideo.module.php to prevent a PHP error about Implicit conversion from float to int

From this

$duration = gmdate("H:i:s", $media->getDuration());

To this

$duration = gmdate("H:i:s", intval($media->getDuration()));

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...