Basics of Cloudinary and PHP
Hi,
I'm trying to understand the basics of creating a video using Cloudinary and PHP.
I'm able to successfully add effects and text onto a video using this code:
$video = (new VideoTag('test_video.mp4'));
$video->effect(Effect::fadeIn()->duration(1000));
$video->effect(Effect::fadeOut()->duration(4000));
$video ->overlay(Overlay::source(Source::text("This text on top",(new TextStyle("Arial",80)))));
echo $video;
This just displays the video without a play button. I can then add the play button using Inspect elements, so I know it works.
But how would you typically work with such a video? Have I now created a new video file or is Cloudinary just editing the file on the fly and displaying the way I want it to every time the file is accessed? Is there a way for me to get the video source file from $video? Should I upload the new video to Cloudinary and get the source code from there? Or what's the right procedure?
I realize I probably just lack a basic understanding of how Cloudinary works, so I'd appreciate any input you can provide.
-
Hey there,
You'll need to add the `controls: true` boolean to your list of configurations for the video player. You can read more about implementing controls in the video player by referencing our documentation.0 -
Thanks Zachary. The controller now works by adding
$video->setAttributes(['controls']);
Is it possilbe to print out the url to the video though?
Something like
echo $video->the_video_url;
which would ideally just display the raw url, something like:
0 -
Andri,
Because the Cloudinary player uses videojs as it's base you can feel free to use any of the videojs features. Grabbing the source of your video is as easy asvar myPlayer = videojs('example_video_1'); // set myPlayer.poster('http://example.com/myImage.jpg'); // get console.log(myPlayer.poster()); // 'http://example.com/myImage.jpg'
0
Post is closed for comments.
Comments
3 comments