/*
 * CAQuickTimeLayer.j
 * AppKit
 *
 * Created by Philippe Laval.
 * Copyright 2009, www.nice-panorama.com .
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

@import <AppKit/CPDOMWindowBridge.j>
@import <AppKit/CALayer.j>

@import "CPQuickTimeMovie.j"


@implementation CAQuickTimeLayer : CALayer
{
    CPQuickTimeMovie    _quickTimeMovie;
}

- (void)setQuickTimeMovie:(CPQuickTimeMovie)aQuickTimeMovie
{
    if (_quickTimeMovie == aQuickTimeMovie)
        return;
        
    _quickTimeMovie = aQuickTimeMovie;


	var html = "<object width = \"100%\" height = \"100%\" classid = \"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B%\" codebase = \"http://www.apple.com/qtactivex/qtplugin.cab\">";
	html += "<param name = \"src\" value = \"" + aQuickTimeMovie._fileName + "\"></param>";
	html += "<param name = \"cache\" value = \"true\"></param>";
	html += "<param name = \"autoplay\" value = \"true\"></param>";
	html += "<param name = \"controller\" value = \"false\"></param>";
	html += "<embed src = \"" + aQuickTimeMovie._fileName + "\" type = \"video/quicktime\"";
	html += " controller = \"false\" autoplay = \"true\" cache = \"true\"";
	html += " pluginspace = \"http://www.apple.com/quicktime/download/index.html\"";
	html += " width = \"100%\" height = \"100%\"></embed>";
	html += "</object>";

	// CPLog.trace(html);
	_DOMElement.innerHTML = html;
}

- (CPQuickTimeMovie)quickTimeMovie
{
    return _quickTimeMovie;
}

@end
