solved youtube embed

alt=
lets go
@devcentricbeats
8 years ago
118 posts
Trying to embed the latest video from a users profile using this code

{jrYouTube_embed type="iframe" item_id=$_item_id order_by="_created desc" profile_id=$_profile_id auto_play=false width="100%"}

with no prevail
updated by @devcentricbeats: 10/30/16 01:58:50AM
paul
@paul
8 years ago
4,326 posts
Where are you trying to embed this? Check that $_item_id and $_profile_id are valid variables by putting a {debug} into the template prior to the embed call. Also make sure that the YouTube module is configured with the correct YouTube API key.


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
8 years ago
7,714 posts
Where did you get that code from? It seams wrong. You're passing in the $_item_id, but then have an order_by="" field. That doesnt seam to make sense. it reads: "Get me this specific youtube video, then order it in reverse alphabetical order, but only get it if its from this specific profile."

The request doesn't make sense. If you know the youtube video you want, you can just ask for it
{jrYouTube_embed type="iframe" item_id=31 auto_play=false width="100%"}

Change the item_id to whatever item_id you want or pass in the $_item_id variable if that is a single number that corresponds to the number of the youtube item stored in the datastore.
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
"If you know the youtube video you want, you can just ask for it"

-Maybe he's trying to always have the LATEST video from a particular user showing somewhere on his site aside from on their profile- as opposed to embedding one certain video from that user? He did mention 'latest video'.

I was thinking (dangerous, yes)...considering that our Youtube videos are already embeds, does trying to 'embed an embed' come into play here and mess things up ...maybe? I know nothing, just a thought.


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
alt=
lets go
@devcentricbeats
8 years ago
118 posts
Thank you everyone for your help.

I im trying to have the latest imported youtube video from the users profile embeded in the profile_index.
Like the latest audio or blog uploaded but embeded.

Here is a example on my site http://centricbeats.com/dr-boyce-watkins of how i want it to look.
so i dont want to have to manually add the item id to each profile that has imported videos.
updated by @devcentricbeats: 07/27/16 04:19:11PM
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
I would try using jrCore_list to search for the latest youtube on a profile (use the return_item_id_only parameter), then use that item_id in your youtube embed.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
8 years ago
7,714 posts
Strumelia:....
"If you know the youtube video you want, you can just ask for it"
-Maybe he's trying to always have the LATEST video from a particular user showing somewhere on his site aside from on their profile- as opposed to embedding one certain video from that user? He did mention 'latest video'.....

Yup, nice one, you're onto it :) . But before we can jump to the complex we first need to get the simple working.

In order to make that code I posted above show the latest video all that needs doing is to replace the 31 with the variable that contains the number of the latest video.

Ah, but how do we get that........ A: It depends on where we are. Maybe that info is available in the {debug} like @paul suggested, but it only will be if we're in some sort of {jrCore_list} like @ultrajam suggested.

Now that we know the full question: "I'm trying to have the latest imported youtube video from the users profile embedded in the profile_index."

We need to add in a way to get the latest video's item_id

{capture assign="template"}
{literal}
    {if isset($_items) && is_array($_items)}
        {foreach $_items as $item}
            {jrYouTube_embed type="iframe" item_id=$item._item_id auto_play=false width="100%"}
        {/foreach}
    {/if}
{/literal}
{/capture}
{jrCore_list module="jrYouTube" order_by="_created desc" search1="profile_id = $profile_id" template=$template limit=1}

The {capture} in the code is to avoid having to add another file to the file system, there are docs on it here:

Docs: "HowTo: use {capture} to avoid using another file for {jrCore_list} calls"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/1637/howto-use-capture-to-avoid-using-another-file-for-jrcore-list-calls
alt=
lets go
@devcentricbeats
8 years ago
118 posts
Thanks everyone. @michael the code worked perfectly. Im reading up on {capture} now. I will be doing the same for vemeo and soundcloud thanks
michael
@michael
8 years ago
7,714 posts
Cool, I re-read the docs on on {capture} they were a bit unclear, so I've tried to clarify them. refresh that page now.
alt=
lets go
@devcentricbeats
8 years ago
118 posts
ok. thanks

Tags