1

The drupalgap video embed field plays youtube videos https://github.com/signalpoint/video_embed_field/blob/7.x-1.x/video_embed_field.js:

$.each(items, function(delta, item) {
    var src = item.video_url.replace('watch?v=', 'embed/'); //structure of youtube
    var width = drupalgap_max_width();
    var height = width * .75;
    var attrs = {
      width: width,
      height: height,
      src: src,
      frameborder: '0',
      allowfullscreen: null
    };
    content[delta] = {
      markup: '<iframe ' + drupalgap_attributes(attrs) + '></iframe>'
    };
});

How can I play vimeo videos given the video_url structure below?

[{"video_url":"https://vimeo.com/157728217","thumbnail_path":"public://video_embed_field_thumbnails/vimeo/157728217.jpg","video_data":"a:21:{s:4:\"type\";s:5:\"video\";s:7:\"version\";s:3:\"1.0\";s:13:\"provider_name\";s:5:\"Vimeo\";s:12:\"provider_url\";s:18:\"https://vimeo.com/\";s:5:\"title\";s:19:\"costs and revenues1\";s:11:\"author_name\";s:3:\"max\";s:10:\"author_url\";s:29:\"http://vimeo.com/user47459015\";s:7:\"is_plus\";s:1:\"0\";s:4:\"html\";s:191:\"<iframe src=\"https://player.vimeo.com/video/157728217\" width=\"1280\" height=\"720\" frameborder=\"0\" title=\"costs and revenues1\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\";s:5:\"width\";i:1280;s:6:\"height\";i:720;s:8:\"duration\";i:492;s:11:\"description\";s:0:\"\";s:13:\"thumbnail_url\";s:46:\"http://i.vimeocdn.com/video/559067454_1280.jpg\";s:15:\"thumbnail_width\";i:1280;s:16:\"thumbnail_height\";i:720;s:30:\"thumbnail_url_with_play_button\";s:139:\"http://i.vimeocdn.com/filter/overlay?src=http://i.vimeocdn.com/video/559067454_1280.jpg&src=http://f.vimeocdn.com/p/images/crawler_play.png\";s:11:\"upload_date\";s:19:\"2016-03-04 09:37:12\";s:8:\"video_id\";i:157728217;s:3:\"uri\";s:17:\"/videos/157728217\";s:7:\"handler\";s:5:\"vimeo\";}","embed_code":null,"description":"desc of video JS client"}]

 [{"video_url":"https://www.youtube.com/watch?v=Q86V-UHaw6Y","thumbnail_path":"public://video_embed_field_thumbnails/youtube/Q86V-UHaw6Y.jpg","video_data":"a:1:{s:7:\"handler\";s:7:\"youtube\";}","embed_code":null,"description":""}]2016-05-27 08:42:32.365 Name of App[1120:18676] [{"video_url":"https://www.youtube.com/watch?v=Q86V-UHaw6Y","thumbnail_path":"public://video_embed_field_thumbnails/youtube/Q86V-UHaw6Y.jpg","video_data":"a:1 {s:7:\"handler\";s:7:\"youtube\";}","embed_code":null,"description":""}]2016-05-27 08:42:32.366 Name of App[1120:18676]

UPDATE:

The line below adds "embed" within the vimeo link. Unfortunately, the video does not render in DrupalGap.

var src = item.video_url.slice(0, 17) + '/embed/' + item.video_url.slice(-9);

UPDATE 2:

There is some info how to embed vimeo videos.

https://developer.vimeo.com/apis/oembed

I noticed that the src parameter is called "url". I changed this in the attributes and passed different video links (e.g. https://player.vimeo.com/video/157728217) as url, but nothing worked.

Here is the stringified content variable from the DG video embed field:

2016-06-01 08:52:13.752 Name of App[1642:30309] content:{"0":{"markup":"<iframe width=\"288\" height=\"216\" url=\"https://vimeo.com/embed/157728217\" frameborder=\"0\" allowfullscreen=\"null\" ></iframe>"}}
  • What does the html output look like in DrupalGap for the Vimeo video? What html output does Vimeo want a typically embeded widget to look like? – tyler.frankenstein May 31 '16 at 17:50
  • Any reason why you don't use the oembed module? It's working with most popular services by default. drupal.org/project/oembed – Volker Jun 1 '16 at 7:31
  • It is not on the DrupalGap modules list: drupalgap.org/project/modules – user24957 Jun 1 '16 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.