Commit 41b2034a authored by Daniel Rossi's avatar Daniel Rossi
Browse files

- #34 parse share config params from the player urls before generating the embed code.

parent 44e3092e
......@@ -12,6 +12,7 @@ sVersion history:
- #618 refactored server return to not require json output anymore and return success. Return success on all request errors with logging, return success on token error with logging. Added 3 new configurable email labels,
"success", "required", "sending"
- #12 if css method used as a getter just return the current style config.
- #34 parse share config params from the player urls before generating the embed code.
3.2.11
------
......
......@@ -49,6 +49,7 @@ package org.flowplayer.viralvideos {
private var _optionsContainer:Sprite;
private var _config:EmbedConfig;
private var _buttonConfig:ButtonConfig;
private var _embedCodeStr:String;
public function EmbedView(plugin:DisplayPluginModel, player:Flowplayer, config:EmbedConfig, buttonConfig:ButtonConfig, style:Object) {
super("viral-embed", plugin, player, style);
......@@ -164,7 +165,8 @@ package org.flowplayer.viralvideos {
private function changeCode():void {
log.debug("changeCode");
_embedCode.htmlText = '<span class="embed">' + _config.playerEmbed.getEmbedCode(true).replace(/\</g, "&lt;").replace(/\>/g, "&gt;") + '</span>';
_embedCodeStr = _config.playerEmbed.getEmbedCode(true);
_embedCode.htmlText = '<span class="embed">' + _embedCodeStr.replace(/\</g, "&lt;").replace(/\>/g, "&gt;") + '</span>';
}
private function initEmbedCodeSettings():void {
......@@ -252,7 +254,7 @@ package org.flowplayer.viralvideos {
private function onCopyToClipboard(event:MouseEvent):void {
initEmbedCodeSettings();
System.setClipboard(_config.playerEmbed.getEmbedCode(true));
System.setClipboard(_embedCodeStr);
stage.focus = _embedCode;
setSelection();
_infoLabel.htmlText = '<span class="info">Copied to clipboard</span>';
......
......@@ -12,8 +12,8 @@ package org.flowplayer.viralvideos {
import com.adobe.serialization.json.JSON;
import flash.display.Stage;
import flash.external.ExternalInterface;
import flash.net.URLVariables;
import flash.utils.ByteArray;
import org.flowplayer.model.DisplayPluginModel;
import org.flowplayer.model.PluginModel;
......@@ -23,9 +23,6 @@ package org.flowplayer.viralvideos {
import org.flowplayer.view.StyleableSprite;
import org.flowplayer.viralvideos.config.Config;
import org.flowplayer.viralvideos.config.EmbedConfig;
import flash.utils.ByteArray;
import org.flowplayer.viralvideos.config.ShareConfig;
public class PlayerEmbed {
......@@ -241,14 +238,16 @@ package org.flowplayer.viralvideos {
public function getEmbedCode(escaped:Boolean = false):String {
var configStr:String = getPlayerConfig(escaped);
//#34 parse share config params from the player urls before generating the embed code.
var playerSwfURL:String = formatURL(_player.config.playerSwfUrl);
var code:String =
'<object name="player" id="_fp_' + Math.random() + '" width="' + width + '" height="' + height + '"' +
' data="' + _player.config.playerSwfUrl + '" type="application/x-shockwave-flash">' +
' data="' + playerSwfURL + '" type="application/x-shockwave-flash">' +
' <param value="true" name="allowfullscreen"/>' +
' <param value="always" name="allowscriptaccess"/>' +
' <param value="' + _embedConfig.wmode + '" name="wmode"/>' +
' <param value="high" name="quality"/>' +
' <param name="movie" value="' + _player.config.playerSwfUrl + '" />' +
' <param name="movie" value="' + playerSwfURL + '" />' +
' <param value="config=' + configStr + '" name="flashvars"/>';
if (_embedConfig.fallbackUrls.length > 0) {
......@@ -267,6 +266,20 @@ package org.flowplayer.viralvideos {
return code;
}
/**
* #34 parse share config params from the player urls before generating the embed code.
* @param url
* @return
*/
private function formatURL(url:String):String
{
var parts:Array = url.split("?");
if (!parts[1]) return url;
var vars:URLVariables = new URLVariables(parts[1]);
delete(vars.config);
return parts[0] + "?" + vars.toString();
}
public function get width():int {
if (_width > 0) return _width;
return _embedConfig.width ? _embedConfig.width :_stage.stageWidth;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment