src/js/init.js
branchnew-model
changeset 919 972099304059
parent 917 eb8677d3a663
child 922 096c06aea8b5
--- a/src/js/init.js	Wed Jun 20 18:41:41 2012 +0200
+++ b/src/js/init.js	Tue Jun 26 14:22:29 2012 +0200
@@ -130,8 +130,32 @@
 
 IriSP.Metadataplayer.prototype.onVideoDataLoaded = function() {
     if (typeof this.videoData !== "undefined" && typeof this.config.player.video === "undefined") {
-        var _media = this.videoData.currentMedia;
-        if (typeof _media !== "undefined") {
+        
+        var _media;
+        
+        if (typeof this.videoData.mainMedia !== "undefined") {
+            _media = this.videoData.getElement(this.videoData.mainMedia);
+        }
+        
+        if (this.config.player.type === "mashup" || this.config.player.type === "mashup-html") {
+            if (typeof _media === "undefined" || _media.elementType !== "mashup") {
+                var _mashups = this.videoData.getMashups();
+                if (_mashups.length) {
+                    _media = _mashups[0];
+                }
+            }
+        } else {
+            if (typeof _media === "undefined" || _media.elementType !== "media") {
+                var _medias = this.videoData.getMedias();
+                if (_medias.length) {
+                    _media = _medias[0];
+                }
+            }
+        }
+        
+        this.videoData.currentMedia = _media;
+        
+        if (typeof _media !== "undefined" && typeof _media.video !== "undefined") {
             this.config.player.video = _media.video;
             if (typeof _media.streamer !== "undefined") {
                 this.config.player.streamer = _media.streamer;