rtmedia_title () as a variable

Hi, I’m trying to capture the name of each uploaded video. I think the variable used in media-gallery-item.php is rtmedia_title();

How do access this variable? If I have three items in the media gallery and I can see each one has a name and an ID, how do I capture the unique identifier using rtmedia_title(); ?

My ideal is to set a variable $moviename =

… but I’m not sure how to capture name or id for each video.

Thanks — Dave B.

Hi Dave,
Can you give me some more information? Where exactly you want file name?
rtmedia_title() is used inside the rtMedia media loop.

Hi Ritesh,

Here’s what I’m doing with rtmedia:

I’ve created an application that takes the username, user email, a salutation, message and a link to the rtmedia video and bundles everything into an email.

The goal is to send an email to a customer that contains the video link and a marketing video.

However I need to capture the video name, wordpress filename and the video link from rtmedia and put them into variables. How can I do that? I have everything except the rtmedia filename variable.

Can you you help me?

Thanks — Dave B.

Hi Dave,
if you have id of that video than you can get video title by using this function get_rtmedia_title. Pass id of video to that function.

Hi Ritesh, thanks for your reply. What if I don’t have the ID for the video? The problem I’ve got is that I need to be able to select a video from media-gallery-item.php, capture the title and ID and place them into variables.

I tried inserting a simple piece of capture code into media-gallery-item.php but it always captures the first item in the page and will not capture the item I am pointing too.

Can you give me some example code to insert into media-gallery-item.php to capture the variables of the item I am selecting? I’m guessing it is going to use some combination of get_rtmedia_title and media_id but I’m not sure how to do it.

Thanks — Dave B

Hi Dave,

You can use rtmedia_before_item hook to add your content and use $rtmedia_media; global variable which holds the content of current media.

Thank you Ritesh that was definitely helpful.

However, although I can now easily echo the permalink veriable, I’m stuck because I’m using AWS S3/Cloudfront. In order for a video to “play” I need to grab the actual S3 filename and the permalink doesn’t seem to do that.

I can see that you guys are playing the video in your own player using the correct S3/Cloudfront video name. How do I get to that? I need to play the video in a player, both inside Wordpress and also in an external PHP file.

Thanks — Dave B.

That’s strange because rtMedia works fine with AWS S3/cloudfront. There isn’t any special kind of setup for rtMedia. Please check your settings again.

Hi Ritesh, actually my settings are good and AWS is working fine. The issue I have is with the permalink. If I capture the permalink of the video using media-gallery-item.php it gives me a video “posting” permalink such as: http://ouagbeta.com/other-members/OUAG-Support/media/87/.

Unfortunately I can’t use this to play the video using mediaelements. I’m trying to get to the actual video file name because I want to form my own page, and play the video in a player.

How do I get to the actual media file url and set it as a variable?

Thanks — Dave B

Hi Dave,
Can you give me working site URL where I can check this?

Hi Ritesh, I think we got off track a little and I had to read through much of the existing RTmedia PHP to find what I was looking for. Eventually I found it in the rt-template-functions.php (lines 288 through 291). The variable I was looking for is:

global $rtmedia_media, $rtmedia;
wp_get_attachment_url( $rtmedia_media->media_id );

This provides the attachment URL directly and then I can carry that forward to an external PHP an play it directly using <video src="’ . wp_get_attachment_url( $rtmedia_media->media_id ) . ‘" ’ . $size . ’ type=“video/mp4” class=“wp-video-shortcode” id="bp_media_video_’ . $rtmedia_media->id . '" controls=“controls” preload=“true”>

I’m publishing this here just in case somebody else is looking for it.

Many Thanks — Dave B.

This gives me

Hi Dave,

I am glad to know that you had figured out the variable.