Get direct Vimeo video url Android

Andrew F picture Andrew F · Apr 13, 2014 · Viewed 24.6k times · Source

I need to play Vimeo viodes in my app having only video id. For example 83342420. How can I get vimeo video url? Or is there any other way to play video in android?

I tried WebView solution but it doesn't suit. I also tried the urls like http://vimeo.com/moogaloop/play/clip:7926539/5cd4f7989ee0cb5018c131260aa1fc8c/1309860388/ but I'm getting 404 Not found. Maybe I need some kind of api key or token?

Thanks.

Answer

Andrew F picture Andrew F · Apr 13, 2014

Ok. For getting direct url for Vimeo video just need to send GET Request to url:

old url - http://player.vimeo.com/v2/video/<video_id>/config
**UPD**: new url - http://player.vimeo.com/video/<video_id>/config

In result you will get such response:

{
  "cdn_url": "http://f.vimeocdn.com",
  "view": 1,
  "request": {
    "files": {
      "h264": {
        "mobile": {
          "profile": 116,
          "origin": "ns3.pdl",
          "url": "http://pdl.vimeocdn.com/84730/904/216566897.mp4?token2=1397407519_8b323701fa08b3531612d6160be9cc5e&aksessionid=01788ff54890a9b2",
          "height": 270,
          "width": 480,
          "id": 216566897,
          "bitrate": 547,
          "availability": 60
        },
        "hd": {
          "profile": 113,
          "origin": "ns3.pdl",
          "url": "http://pdl.vimeocdn.com/87179/143/216566895.mp4?token2=1397407519_1d0ef28841fb628c423f9dbeb93168d4&aksessionid=2a0b480300c82ef7",
          "height": 720,
          "width": 1280,
          "id": 216566895,
          "bitrate": 3142,
          "availability": 60
        },
        "sd": {
          "profile": 112,
          "origin": "ns3.pdl",
          "url": "http://pdl.vimeocdn.com/57248/568/216566886.mp4?token2=1397407519_395f6cf4e80b98826424e21c8de508d1&aksessionid=598e59776ed0979a",
          "height": 360,
          "width": 640,
          "id": 216566886,
          "bitrate": 1198,
          "availability": 60
        }
      },
      "hls": {
        "all": "http://av20.hls.vimeocdn.com/i/,57248/568/216566886,87179/143/216566895,84730/904/216566897,.mp4.csmil/master.m3u8?primaryToken=1397407519_93cf5d54b3482e3a1e716cf28b9550a7",
        "hd": "http://av20.hls.vimeocdn.com/i/,87179/143/216566895,.mp4.csmil/master.m3u8?primaryToken=1397407519_a84194ace821175f0ee0ff9ab8d9241f"
      },
      "codecs": [
        "h264"
      ]
    },
    "ga_account": "UA-76641-35",
    "timestamp": 1397406594,
    "expires": 925,
    "prefix": "/v2",
    "session": "d85291b3aa5b3e5fbf3ea82d81d7d5e849aa50e5",
    "cookie": {
      "scaling": 1,
      "volume": 1.0,
      "hd": null,
      "captions": null
    },
    "cookie_domain": ".vimeo.com",
    "referrer": null,
    "conviva_account": "c3.Vimeo",
    "flags": {
      "login": 1,
      "preload_video": 1,
      "plays": 1,
      "partials": 1,
      "conviva": 1
    },
    "build": {
      "player": "a30ff35f",
      "js": "2.4.7"
    },
    "urls": {
      "zeroclip_swf": "http://f.vimeocdn.com/p/external/zeroclipboard/ZeroClipboard.swf",
      "js": "http://f.vimeocdn.com/p/2.4.7/js/player.js",
      "proxy": "https://f.vimeocdn.com/p/2.4.7/proxy.html",
      "conviva": "http://livepassdl.conviva.com/ver/2.72.0.13589/LivePass.js",
      "flideo": "http://f.vimeocdn.com/p/flash/flideo/1.0.3b10/flideo.swf",
      "canvas_js": "http://f.vimeocdn.com/p/2.4.7/js/player.canvas.js",
      "moog": "http://f.vimeocdn.com/p/flash/moogaloop/6.0.9/moogaloop.swf?clip_id=83342420",
      "conviva_service": "http://livepass.conviva.com",
      "moog_js": "http://f.vimeocdn.com/p/2.4.7/js/moogaloop.js",
      "zeroclip_js": "http://f.vimeocdn.com/p/external/zeroclipboard/ZeroClipboard-patch.js",
      "css": "http://f.vimeocdn.com/p/2.4.7/css/player.css"
    },
    "signature": "09c6bc41e6a7d343748ed3e00420a108"
  },
  "player_url": "player.vimeo.com",
  "video": {
    "allow_hd": 1,
    "height": 720,
    "owner": {
      "account_type": "pro",
      "name": "Sabian",
      "img": "http://i.vimeocdn.com/portrait/2511583_75x75.jpg",
      "url": "http://vimeo.com/sabian",
      "img_2x": "http://i.vimeocdn.com/portrait/2511583_150x150.jpg",
      "id": 8487062
    },
    "thumbs": {
      "1280": "http://i.vimeocdn.com/video/459788805_1280.jpg",
      "960": "http://i.vimeocdn.com/video/459788805_960.jpg",
      "640": "http://i.vimeocdn.com/video/459788805_640.jpg"
    },
    "duration": 25,
    "id": 83342420,
    "hd": 1,
    "embed_code": "<iframe src=\"//player.vimeo.com/video/83342420\" width=\"500\" height=\"281\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>",
    "default_to_hd": 0,
    "title": "Mike Portnoy",
    "url": "https://vimeo.com/83342420",
    "privacy": "anybody",
    "share_url": "http://vimeo.com/83342420",
    "width": 1280,
    "embed_permission": "public",
    "fps": 24.0
  },
  "build": {
    "player": "a30ff35f",
    "rpc": "dev"
  },
  "embed": {
    "player_id": null,
    "outro": "videos",
    "api": 2,
    "context": "embed.main",
    "time": 0,
    "color": "00adef",
    "settings": {
      "fullscreen": 1,
      "byline_badge": {
        "url": "http://vimeo.com/sabian",
        "type": "pro"
      },
      "byline": 1,
      "like": 1,
      "playbar": 1,
      "title": 1,
      "color": 0,
      "branding": 1,
      "share": 1,
      "scaling": 1,
      "logo": 1,
      "info_on_pause": 0,
      "watch_later": 1,
      "portrait": 1,
      "embed": 1,
      "badge": 0,
      "volume": 1
    },
    "on_site": 0,
    "loop": 0,
    "autoplay": 0
  },
  "vimeo_url": "vimeo.com",
  "user": {
    "liked": 0,
    "account_type": "basic",
    "logged_in": 1,
    "owner": 0,
    "watch_later": 0,
    "id": 26896968,
    "mod": false
  }
}