Browse Source

Add DailyMotion media type

pull/75/head
Salvador Diaz 13 years ago
parent
commit
131994bd6b
  1. 12
      examples/kitchen-sink/data.json
  2. 4
      source/js/VMM.Media.js
  3. 8
      source/js/VMM.MediaElement.js
  4. 8
      source/js/VMM.MediaType.js

12
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."
}
}
]
}
}
}

4
source/js/VMM.Media.js

@ -66,6 +66,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Media == 'undefined') {
VMM.appendElement($mediacontainer, "<iframe frameborder='0' src='http://www.youtube.com/embed/" + m.id + "?&rel=0&theme=light&showinfo=0&hd=1&autohide=0&color=white' allowfullscreen>");
} else if (m.type == "vimeo") {
VMM.appendElement($mediacontainer, "<iframe frameborder='0' src='http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'>");
} else if (m.type == "dailymotion") {
VMM.appendElement($mediacontainer, "<iframe frameborder='0' src='http://www.dailymotion.com/embed/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'>");
} else {
}
@ -160,4 +162,4 @@ if(typeof VMM != 'undefined' && typeof VMM.Media == 'undefined') {
return _active;
};
}
}

8
source/js/VMM.MediaElement.js

@ -33,6 +33,9 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
} else if (m.type == "vimeo") {
mediaElem = "<div class='thumbnail vimeo'></div>";
return mediaElem;
} else if (m.type == "dailymotion") {
mediaElem = "<div class='thumbnail dailymotion'></div>";
return mediaElem;
} else if (m.type == "twitter"){
mediaElem = "<div class='thumbnail twitter'></div>";
return mediaElem;
@ -99,6 +102,9 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
// VIMEO
} else if (m.type == "vimeo") {
mediaElem = "<iframe class='media-frame video vimeo' autostart='false' frameborder='0' width='100%' height='100%' src='http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'></iframe>";
// DAILYMOTION
} else if (m.type == "dailymoton") {
mediaElem = "<iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe>";
// TWITTER
} else if (m.type == "twitter"){
mediaElem = "<div class='twitter' id='" + "twitter_" + m.id + "'><span class='messege'>Loading Tweet</span></div>";
@ -158,4 +164,4 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
},
}).init();
}
}

8
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;
}
}
}

Loading…
Cancel
Save