From 3a759f81e30fe9ec5bcfb6fd9bc48e1a01cd4995 Mon Sep 17 00:00:00 2001 From: Kate Hudson Date: Tue, 5 Mar 2013 11:50:01 -0500 Subject: [PATCH 1/3] [t3268] Convert URL stuff to being not editable, pull clip metadata --- css/editors.less | 14 ++ css/media-editor.less | 215 +++++++++++++++--------------- src/editor/sequencer-editor.js | 39 +++++- src/layouts/sequencer-editor.html | 12 +- 4 files changed, 168 insertions(+), 112 deletions(-) diff --git a/css/editors.less b/css/editors.less index 8245a72a0..9b060ff3e 100644 --- a/css/editors.less +++ b/css/editors.less @@ -592,6 +592,20 @@ textarea { margin: 0; padding: 10px 20px; border-bottom: 1px solid @baseLightOutline; + &.media-properties { + font-size: 11px; + background: darken( @baseLight, 5% ); + .clearfix(); + } +} + +.source-container { + display: none; + margin-bottom: 5px; + &.loaded { + display: block; + } + .clearfix(); } .butter-form .switch { diff --git a/css/media-editor.less b/css/media-editor.less index e8907b98e..972348ff0 100644 --- a/css/media-editor.less +++ b/css/media-editor.less @@ -132,112 +132,6 @@ border-radius: 2px; } - .media-gallery-item { - position: relative; - padding: 10px 20px; - height: 60px; - border: 0 solid @baseLightOutline; - border-top-width: 1px; - background-color: @baseLight; - font-size: 11px; - .transition( background-color 0.2s linear ); - &:first-child { - margin-top: -1px; - } - &.new { - background: @green; - color: #FFF; - > .delete-btn { - display: none; - } - > .mg-meta-data { - > .mg-type { - color: #FFF; - } - } - } - } - - .mg-thumbnail { - position: relative; - overflow: hidden; - float: left; - margin-right: 10px; - border: 1px solid @baseLightOutline; - > img, video { - display: block; - width: 80px; - height: 60px; - } - &:hover { - border-color: @green; - } - &:hover:before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; - background: fade( @green, 60% ); - } - &:hover:after { - content: ""; - height: 14px; - width: 14px; - position: absolute; - top: 50%; - margin-top: -7px; - margin-left: -7px; - left: 50%; - background: url( "../resources/icons/glyphiconshalflings-white.png" ) -408px -96px no-repeat; - } - } - .mg-html5 .mg-thumbnail { - > video { - height: auto; - } - background: url( "../resources/icons/media.png" ) center no-repeat; - } - - .mg-meta-data { - float: left; - width: 190px; - height: 60px; - line-height: 1.2em; - } - .mg-title { - overflow: hidden; - font-weight: 700; - max-height: 3.6em; // 3 lines - } - .mg-type { - &:after { - content: " clip"; - text-transform: lowercase; - } - color: #999; - text-transform: capitalize; - } - .mg-error { - color: #FF0000; - } - .mg-duration { - &:before { - content: "Duration: " - } - } - .mg-delete-btn { - position: absolute; - top: 10px; - right: 5px; - opacity: 0.5; - &:hover { - opacity: 1; - } - } - .add-media-input { height: 50px; } @@ -261,3 +155,112 @@ } } + +.media-gallery-item { + position: relative; + padding: 10px 20px; + height: 60px; + border: 0 solid @baseLightOutline; + border-top-width: 1px; + background-color: @baseLight; + font-size: 11px; + .transition( background-color 0.2s linear ); + &:first-child { + margin-top: -1px; + } + &.new { + background: @green; + color: #FFF; + > .delete-btn { + display: none; + } + > .mg-meta-data { + > .mg-type { + color: #FFF; + } + } + } +} + +.mg-thumbnail { + position: relative; + overflow: hidden; + float: left; + margin-right: 10px; + border: 1px solid @baseLightOutline; + width: 80px; + height: 60px; + > img, video { + display: block; + width: 80px; + height: 60px; + } + &:hover { + border-color: @green; + } + &:hover:before { + content: ""; + display: block; + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + background: fade( @green, 60% ); + } + &:hover:after { + content: ""; + height: 14px; + width: 14px; + position: absolute; + top: 50%; + margin-top: -7px; + margin-left: -7px; + left: 50%; + background: url( "../resources/icons/glyphiconshalflings-white.png" ) -408px -96px no-repeat; + } +} +.mg-html5 .mg-thumbnail { + > video { + height: auto; + } + background: url( "../resources/icons/media.png" ) center no-repeat; +} + +.mg-meta-data { + float: left; + width: 190px; + height: 60px; + line-height: 1.2em; +} +.mg-title { + overflow: hidden; + font-weight: 700; + max-height: 3.6em; // 3 lines +} +.mg-type { + &:after { + content: " clip"; + text-transform: lowercase; + } + color: #999; + text-transform: capitalize; +} +.mg-error { + color: #FF0000; +} +.mg-duration { + &:before { + content: "Duration: " + } +} +.mg-delete-btn { + position: absolute; + top: 10px; + right: 5px; + opacity: 0.5; + &:hover { + opacity: 1; + } +} + diff --git a/src/editor/sequencer-editor.js b/src/editor/sequencer-editor.js index 80927c205..0c897768a 100644 --- a/src/editor/sequencer-editor.js +++ b/src/editor/sequencer-editor.js @@ -451,16 +451,48 @@ define( [ "util/mediatypes", "editor/editor", "util/time", }; _fields.startEnd = new StartEnd( startEndContainer, "start", _this.updateTrackEventSafe ); - _fields.source = new Input( sourceEl, "source", sourceCallback, sourceUpdateUI ); + // _fields.source = new Input( sourceEl, "source", sourceCallback, sourceUpdateUI ); _fields.fallback = new Input( fallbackEl, "fallback", _this.updateTrackEventSafe, fallbackUpdateUI ); _fields.title = new Input( titleEl, "title", _this.updateTrackEventSafe ); _fields.mute = new Toggler( muteEl, "mute", "reverse", muteUpdateUI ); _fields.volume = new Slider( sliderEl, "volume" ); _fields.hidden = new Toggler( hiddenEl, "hidden", "reverse" ); _fields.from = new Trimmer( clipTrimmerEl ); + _fields.source = { + el: sourceEl, + updateUI: function() { + if ( !Array.isArray( _popcornOptions.source ) ) { + _popcornOptions.source = [ _popcornOptions.source ]; + } - Textbox.applyTo( _fields.source.el, "textarea" ); - Textbox.applyTo( _fields.fallback.el, "textarea" ); + if ( MediaUtils.checkUrl( _popcornOptions.source[ 0 ] ) === "html5" ) { + fallbackContainer.classList.add( "show" ); + } else { + fallbackContainer.classList.remove( "show" ); + } + + MediaUtils.getMetaData( _popcornOptions.source[ 0 ], function( data ) { + var thumbnailImg; + sourceEl.classList.add( "loaded" ); + sourceEl.querySelector( ".mg-title" ).innerHTML = data.title; + sourceEl.querySelector( ".mg-type" ).innerHTML = data.type; + sourceEl.querySelector( ".mg-duration" ).innerHTML = Time.toTimecode( data.duration ) || "???"; + if ( data.type === "html5" ) { + thumbnailImg = data.thumbnail; + } else { + thumbnailImg = document.createElement( "img" ); + thumbnailImg.src = data.thumbnail; + sourceEl.querySelector( ".mg-thumbnail" ).appendChild( thumbnailImg ); + } + sourceEl.classList.add( "mg-" + data.type ); + sourceEl.querySelector( ".mg-title" ).addEventListener( "click", function( e ) { + _butter.editor.openEditor( "media-editor" ); + }, false ); + }); + } + }; + + _fields.source.updateUI(); } //setup @@ -478,6 +510,7 @@ define( [ "util/mediatypes", "editor/editor", "util/time", } } } + _this.setErrorState( false ); } diff --git a/src/layouts/sequencer-editor.html b/src/layouts/sequencer-editor.html index 04842a9a6..faf596de3 100644 --- a/src/layouts/sequencer-editor.html +++ b/src/layouts/sequencer-editor.html @@ -9,9 +9,15 @@

Clip editor

- - - +
+
+ +