src/js/model.js
branchnew-model
changeset 903 d9da52e20f7f
parent 902 14022f1d49ab
child 904 510ebab76fa3
--- a/src/js/model.js	Mon May 14 16:59:07 2012 +0200
+++ b/src/js/model.js	Tue May 15 15:50:19 2012 +0200
@@ -573,6 +573,26 @@
     }
 }
 
+IriSP.Model.Mashup.prototype.getAnnotationAtTime = function(_time) {
+    var _list = this.segments.filter(function(_annotation) {
+        return _annotation.begin <= _time && _annotation.end > _time;
+    });
+    if (_list.length) {
+        return _list[0];
+    } else {
+        return undefined;
+    }
+}
+
+IriSP.Model.Mashup.prototype.getMediaAtTime = function(_time) {
+    var _annotation = this.getAnnotationAtTime(_time);
+    if (typeof _annotation !== "undefined") {
+        return _annotation.getMedia();
+    } else {
+        return undefined;
+    }
+}
+
 /* */
 
 IriSP.Model.Source = function(_config) {