From 131994bd6b740e09ca3a206858ee82ab98442be8 Mon Sep 17 00:00:00 2001 From: Salvador Diaz Date: Sun, 6 May 2012 17:56:35 +0200 Subject: [PATCH] Add DailyMotion media type --- examples/kitchen-sink/data.json | 12 +++++++++++- source/js/VMM.Media.js | 4 +++- source/js/VMM.MediaElement.js | 8 +++++++- source/js/VMM.MediaType.js | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/examples/kitchen-sink/data.json b/examples/kitchen-sink/data.json index cb33222..a95a754 100644 --- a/examples/kitchen-sink/data.json +++ b/examples/kitchen-sink/data.json @@ -166,7 +166,17 @@ "credit":"", "caption":"" } + }, + { + "startDate":"2012,5,6", + "headline":"Dailymotion video", + "asset": + { + "media":"http://www.dailymotion.com/video/xcv6dv", + "credit":"PATRICK JEAN", + "caption":"PIXELS is Patrick Jean' latest short film, shot on location in New York." + } } ] } -} \ No newline at end of file +} diff --git a/source/js/VMM.Media.js b/source/js/VMM.Media.js index 0e7062f..b63ce0d 100644 --- a/source/js/VMM.Media.js +++ b/source/js/VMM.Media.js @@ -66,6 +66,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Media == 'undefined') { VMM.appendElement($mediacontainer, ""; + // DAILYMOTION + } else if (m.type == "dailymoton") { + mediaElem = ""; // TWITTER } else if (m.type == "twitter"){ mediaElem = "
Loading Tweet
"; @@ -158,4 +164,4 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') { }, }).init(); -} \ No newline at end of file +} diff --git a/source/js/VMM.MediaType.js b/source/js/VMM.MediaType.js index 7b7eb93..df6fcac 100644 --- a/source/js/VMM.MediaType.js +++ b/source/js/VMM.MediaType.js @@ -32,6 +32,12 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') { media.type = "vimeo"; media.id = vimeo_id; success = true; + } else if (d.match('(www.)?dailymotion\.com')) { + daily_id = d.split(/video\/|\/\/dailymotion\.com\//)[1]; + + media.type = "dailymotion"; + media.id = daily_id; + success = true; } else if (d.match('(player.)?soundcloud\.com')) { //soundcloud_url = unescape(d.split(/value="/)[1].split(/["]/)[0]); //soundcloud_id = soundcloud_url.split(/tracks\//)[1].split(/[&"]/)[0]; @@ -95,4 +101,4 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') { } return false; } -} \ No newline at end of file +}