Page 1 of 2

How to set video-id property of youtube player dynamically

Posted: Wed Jun 25, 2014 2:21 pm
by Robby

I have a dynamic video list based on a database. The data attribute 'data-video-id' of each list item is bound to a field videoId in the database.
I want to set the video-id based of the youtube player dynamically when the user clicks on a list item.

Is it possible to do this with an event action 'set property' ? How can I specify the data attribute 'data-video-id' of the selected list item ?

Or do I need to use the event action 'run javascript' ? How can I access the video-id property in javascript ?


How to set video-id property of youtube player dynamically

Posted: Wed Jun 25, 2014 3:58 pm
by Evgene Karachevtsev

Hello Robby,

'data-video-id' is not a standard property/attribute for list item. Do you put it via js? Then you should refer to it from js. You should add run javascript action on event Click on the list item.
In the js code variable this indicates to list item on which triggered the event. To get property/attribute you should use the appropriate method of jquery http://api.jquery.com/category/manipu...


How to set video-id property of youtube player dynamically

Posted: Thu Jun 26, 2014 7:10 am
by Robby

Hi,

I used this javascript and it works but isn't it possible to set the video id property of the appery youtube component ?

Appery('youtubePlayer').attr('src', 'https://www.youtube.com/embed/' + $(this).attr('data-video-id'));


How to set video-id property of youtube player dynamically

Posted: Thu Jun 26, 2014 7:39 am
by Kateryna Grynko

Hi Robby,

Use the following code:preAppery('youtubePlayer').attr("data-video-id", videoId);/preWhere 'videoId' is a value of new ID.


How to set video-id property of youtube player dynamically

Posted: Sun Sep 28, 2014 12:19 pm
by EJLD

this shld help me.
thks


How to set video-id property of youtube player dynamically

Posted: Wed Oct 01, 2014 1:22 pm
by EJLD

Hi There,

I GET the videoID from the Appery DB.
but neither mapping link, nor the code work unfortunately.

always have the error msg from YouTube "an error occured, pls try again later".

it works only when I place the videoID in the property input field of the builder.

any idea ?

thk you,
Eric


How to set video-id property of youtube player dynamically

Posted: Thu Oct 02, 2014 8:53 am
by Kateryna Grynko

Hi Eric,

We are able to successfully map a value from database to video. Could you please post a screenshot of mapping? When and how do you run a service?


How to set video-id property of youtube player dynamically

Posted: Thu Oct 02, 2014 12:16 pm
by EJLD

thks for your prompt reply.
I don't know why it doesn't work, if it works with you.
it seems so simple.
let me check again and send you some details.
Eric


How to set video-id property of youtube player dynamically

Posted: Thu Oct 02, 2014 12:29 pm
by Kateryna Grynko

Hi Eric,

Thank you. Waiting for the result.


How to set video-id property of youtube player dynamically

Posted: Sat Oct 04, 2014 12:27 pm
by EJLD

Hi Kateryna, I cld manage to both youtube video working. it was a bit unrational but it works.
Best