<%
import org.exoplatform.clouddrive.CloudDrive
import org.exoplatform.clouddrive.CloudFile
import org.exoplatform.wcm.webui.reader.ContentReader

// should be set in CloudFileFilter
def drive = uicomponent.drive
def file = uicomponent.file
if (drive && file) {
  def title = ContentReader.getXSSCompatibilityContent(file.title)
  def serviceName = drive.user.serviceName
  def openOn = _ctx.appRes("CloudFileViewer.event.OpenOn")
%>
<div id="CloudFileViewer" file-open-on="${openOn} ${serviceName}" style="position: relative; height: 100%; overflow: hidden;">
  <div style="text-align:center; display: none;" class="file-content" title="$title">
  	<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
  			codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
				standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="400" height="300">
			<param name="fileName" value="$file.previewLink">
			<param name="animationatStart" value="true">
			<param name="transparentatStart" value="true">
			<param name="autoStart" value="true">
			<param name="showControls" value="true">
			<param name="Volume" value="100">
			<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" 
				src="$file.previewLink" name="MediaPlayer1" width=400 height=300 autostart=1 showcontrols=1 volume=100>
		</object>
  </div>
<%
} else {%>
	<p>Cannot load cloud file viewer. Refresh the page.</p>
<%
}
%>
</div>