Personal tools
You are here: Home PC zope&plone PloneのDivX
Document Actions

PloneのDivX

by かわうぃん last modified 2006-07-17 16:18

DivX Web PlayerをATVideoに実装

PloneのATVideoは、ダウンロードした拡張子から、判別して対応するプレイヤーにて再生します。
mpegであれば、/portal_skins/ATVideo/getMediaWidgetから判定し、 /portal_skins/ATVideo/winmedia_widgetを呼ぶといった形です。

DivX Web Playerのページに、Webコードの記述があるので、適当なURLからこれを産出しておきます。

例:次をクリック(DivXページ内)

 <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" 
     width="320"
     height="260"
     codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="src"
  value="http://trailers.divx.com/Paramount/MissioImpossibleIII.divx" />
<embed type="video/divx"
    src="http://trailers.divx.com/Paramount/MissioImpossibleIII.divx"
    width="320" height="260"
    pluginspage="http://go.divx.com/plugin/download/">
</embed>
</object>

必要な箇所を抜き出す。

clsid : 67DABFBF-D0AB-41fa-9C46-CC0F21721616

codebase :  http://go.divx.com/plugin/DivXBrowserPlugin.cab

src は、表示する 動画ファイル

pluginspage="http://go.divx.com/plugin/download/

これらを設定した、divx_widget(ID名 後のgetMediaWidget中に指定)を Portal_skin/customフォルダに Page_Templateとして作成

<div class="mediawidget">
      <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616"
          width="320"
          height="260"
          codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"
          tal:attributes="width here/getWidth|default;
                          height here/getHeight|default">
        <param name="src" value="20050704.avi"
               tal:attributes="value string:${options/path}">
        <embed src="20050704.avi"
               type="video/divx"
               width="320" height="260"
               pluginspage="http://go.divx.com/plugin/download/"
               tal:attributes="src string:${options/path}/view;
                               width here/getWidth|default;
                               height here/getHeight|default">
        </embed>
      </object>
</div>

そのほかにオプション等も埋め込み可能。

また、ファイル拡張子を識別し、使用する表示プレイヤーを選択する、/portal_skins/ATVideo/getMediaWidgetから「Customize」にて次のように編集。 今回は、AVIファイルであれば、divx_widgetを使用するよう設定。逆にDivXファイル固有の拡張子をつけ(例:divx等)認識させることも可能

id=context.getId()
extension = id.split('.')[1]
res = "Not supported. Video file must be .rm, .wmv, .mov or .mpg"
if extension.lower() == 'rm':
    res = context.realmedia_widget(path=context.getStreamPath(id))
if extension.lower() == 'wmv':
    res = context.winmedia_widget(path=context.getStreamPath(id))

の間に以下を追加

if extension.lower() == 'avi':
    res = context.divx_widget(path=context.getStreamPath(id))

最後は、return resで括る。

あとは、DivXファイルを追加し、次のようにDivX Web Playerで再生されればOK

 

 

 

 


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: