0

I need to know how to embed a video (YouTube or Vimeo) into an infowindow in CartoDB in the same way that an image appears as an image header. Potentially more complicated, when there is no video link I'd like an image to appear instead.

Can anyone assist me (as a non-programmer) with the code for this and WHERE to insert it in the HTML?

I have viewed the "How do you embed iFrame content into a CartoDB infoWindow?" question, but I cannot make that work for either YouTube or Vimeo videos. Also what I am asking for is for it to be a part of the "image header" in CartoDB which is not what that question answers.

closed as off-topic by PolyGeo Feb 4 at 13:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

1

Just tried this out, and it doesn't look that great, but I used:

<div class="cartodb-popup dark">
  <a href="#close" class="cartodb-popup-close-button close">x</a>
    <div class="cartodb-popup-header">
<iframe width="225" height="215" 
 src="//www.youtube.com/embed/QK8mJJJvaes" frameborder="0" allowfullscreen>
</iframe>
  </div>
  <div class="cartodb-popup-content-wrapper">
    <div class="cartodb-popup-content">
      <h4>Crime Type</h4>
      <p>{{cr}}</p>
      <h4>total</h4>
      <p>{{tot}}</p>

    </div>
  </div>
  <div class="cartodb-popup-tip-container"></div>
</div>

To get http://cdb.io/1e7Wf5F Someone with more CSS-fu than me could probably get it to look better.

To do conditional stuff with an image instead of a video I believe you should be able to do it with the mustache templates: http://mustache.github.io/mustache.5.html

  • this doesn't work anymore i don't think as they disabled iframes – ndthl Oct 28 '15 at 20:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.