Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Code issue, Using Json and Oembed for Vimeo

    So i am trying to use Oembed and Json to automatically embed the newest Vimeo video from my channel on the homepage of my website. I got it to embed the video and all but the problem is resizing the video. It always comes in too big and i can't figure out how to fix it. Here is what i have, any help would be great!

    <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript">
    $(function() {
    $.getJSON('http://vimeo.com/api/v2/gavinrudy/videos.json?callback=?', {format: "json"}, function(videoList) {
    $.getJSON('http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/' + videoList[0].id + '&byline=false&portrait=false&callback=?', {format: "json", "width": 900,}, function(videoProperties) {
    document.getElementById("vimeoRecent").innerHTML=videoProperties.html
    document.getElementById("vimeoDescription").innerHTML="<p><a href='" + videoList[0].url + "'>" + videoProperties.title + "</a> from <a href='" + videoProperties.author_url + "'>" + videoProperties.author_name + "</a> on <a href='http://vimeo.com'>Vimeo</a>.</p><p>" + videoProperties.description + "</p>"
    });
    });
    });
    </script>

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    3,020
    Thanks
    56
    Thanked 566 Times in 563 Posts
    I would think this property here:
    Code:
    {format: "json", "width": 900}
    would be a good one to play around with (and please remove the trailing comma if you don't want IE to freak out)

  • Users who have thanked xelawho for this post:

    ethanlphoto (12-21-2012)

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 Posts
    you can use CSS to style the iframe, and the video will resize to fill the iframe as best it can.

    a "width: 400px !important;" in css will cascade over both <iframe width=500> and <iframe style=width:500px>.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •