Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Loading videos dynamically - how to integrate data from json file into video placeholder at Stage

$
0
0

Hi!


Working on a website where I want to display a larger selection of videos. Found a tutorial wtih a great script for loading content dynamically from a json file;

 

$.getJSON("data/press.json", function(data)

         {

           for(var i=0; i<data.length; i++)

             {

                      var s = sym.createChildSymbol("slide", "Stage");

                      s.$("photo").css({"background-image":"url('"+data[i].image+"')"});

                      s.$("title").html(data[i].title);

                      s.$("headtext").html(data[i].headtext);

                      s.getSymbolElement().css({"position":"absolute",

                      "left" : "50px",

                      "top" : i*200+50+"px"});

           }

 
The content in json file looks like this,


[

{

  "image" : "images/poster_.jpg",

  "title" : "my test",

   "date" : "my date",

  "headtext" : "my main text",

  "video" : "http://www....."

},

]

 


Unfortunately there is nothing about video in the script above.

 

Does anyone know how I can,


1/ pick the data from my variable "video" in my json file (guess the script needs a line like:    s.$("video").html(data[i].video);     or something)

 

2/ dynamically put into my video placeholder where my show video script is,

-----

var youtube = $("<iFrame/>");

var url = "https://www.youtube.com.....;"


sym.$("video").append(youtube);

youtube.attr('type','text/html');

youtube.attr('width','640');

youtube.attr('height','360');

youtube.attr('src',url);

-------

 

Most greatful for all kind of advice

 

Best regards

Bengt, informel.se


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>