Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plat 24912:Add support in V2 to V7 redirect #12849

Open
wants to merge 127 commits into
base: Tucana-20.18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
1ba5350
PLAT-24912: v2 to v7
MosheMaorKaltura Jul 21, 2024
6141087
PLAT-24912: add support in redirection player v2 to v7
MosheMaorKaltura Aug 8, 2024
106a9f3
PLAT-24912: add support in v2 to v7
MosheMaorKaltura Aug 8, 2024
231426a
PLAT-24912: code review remarks
MosheMaorKaltura Aug 8, 2024
93f13ad
PLAT-24912: support redirect v2 to v7
MosheMaorKaltura Aug 8, 2024
fa1f089
PLAT-24912: v2 to v7
MosheMaorKaltura Aug 8, 2024
7564a5b
PLAT-24912: v2 to v7
MosheMaorKaltura Aug 8, 2024
ccc7228
PLAT-24912: v2 to v7
MosheMaorKaltura Aug 8, 2024
9996a86
PLAT-24912: Add support in caching of v2tov7 facade
MosheMaorKaltura Aug 11, 2024
9cd4d19
PLAT-24912: Code review remarks
MosheMaorKaltura Aug 12, 2024
937fae0
Code review remarks
MosheMaorKaltura Aug 12, 2024
45a92c5
PLAT-24912: support v2 to v7
MosheMaorKaltura Aug 12, 2024
0a98ae3
1. Map entryId filter to contextId for queries over cnc datasource 2.…
Aug 13, 2024
0b1ca2e
REACH2-1235: Display all reach tasks in Reach Requests tab
drorsou Aug 13, 2024
4d1a6d5
PLAT-24912: add config tp the bundle
MosheMaorKaltura Aug 14, 2024
898c528
REACH2-1236: Require source language captions via API
drorsou Aug 19, 2024
ae2f00e
PLAT-24912: Add support in flash vars translations
MosheMaorKaltura Aug 19, 2024
633d309
PLAT-24912: code review remarks
MosheMaorKaltura Aug 19, 2024
9852f8f
PLAT-24912: code review
MosheMaorKaltura Aug 19, 2024
b09fb6a
REACH2-1267: Add search Catalog Items by id
drorsou Aug 20, 2024
b6fe8aa
REACH2-1266: Allow renaming Catalog Items from Admin Console
drorsou Aug 20, 2024
4c8a141
Updated version - Tucana-20.18.0
inbal-ben-david Aug 12, 2024
2311910
SUP-43860: Purify multilingual fields
drorsou Aug 11, 2024
ca9d5fb
SUP-43860: Remove print
drorsou Aug 11, 2024
cbe60d5
PLAT-24840 burn subs (ongoing)
salma2222 Jul 18, 2024
ee90983
PLAT-24840 burn subs (ongoing)
salma2222 Jul 18, 2024
9e47b43
multi clip burn captions
salma2222 Aug 4, 2024
d4f445c
multi clip burn captions
salma2222 Aug 4, 2024
90a5ed5
multi clip burn captions
salma2222 Aug 4, 2024
fe816fc
multi clip burn captions
salma2222 Aug 4, 2024
113c90f
multi clip refactor
salma2222 Aug 6, 2024
85a162e
multi clip refactor
salma2222 Aug 6, 2024
e390270
caption attributes
salma2222 Aug 6, 2024
828e634
multi clip refactor
salma2222 Aug 6, 2024
cf2b074
remove font style , should be font name
salma2222 Aug 6, 2024
9701834
edge case fix and crop optimization
salma2222 Aug 6, 2024
10b8ed0
multi clip comments
salma2222 Aug 10, 2024
ea8a811
sync subtitles
salma2222 Aug 11, 2024
9f531f3
multi clip refactor
salma2222 Aug 11, 2024
0e2dd0c
indent
salma2222 Aug 11, 2024
2f71403
expose setting crop data
salma2222 Aug 13, 2024
8c3e554
remove log lines
salma2222 Aug 13, 2024
8e3ba57
check fields subtitlesData
salma2222 Aug 13, 2024
c8163d3
Update chunk timeout logic
anatolkaltura Aug 13, 2024
57ae9c3
PLAT-24923: Add fields to exported catalog items CSV
drorsou Aug 13, 2024
dece8da
ONPREM-911 block running scripts in parallel (#12835)
GElkayam Aug 14, 2024
57a8226
CR-19: Clips vendor task
rkreich Aug 6, 2024
921e06d
VCP-15234: delete local thumb tmp file of resizeEntryImage dies for w…
amiras89 Nov 7, 2023
877573a
PLAT-24912:integration issues
MosheMaorKaltura Aug 20, 2024
7e6093b
Merge remote-tracking branch 'origin/Tucana-20.18.0' into Tucana-20.1…
MosheMaorKaltura Aug 21, 2024
664e877
SUP-43987: fix the retry when uploading via s3 multipart upload
amiras89 Aug 22, 2024
d9c6ae8
SUP-44075: extract kuser id without init
coralburg12 Aug 25, 2024
9bc7125
Merge pull request #12854 from kaltura/master-merge-Tucana-20.18.0
inbal-ben-david Aug 28, 2024
aaff267
Updated version - Tucana-20.19.0
inbal-ben-david Aug 28, 2024
fc70507
Merge pull request #12855 from kaltura/Tucana-20.19.0-update-version
inbal-ben-david Aug 28, 2024
0afe31d
fix copyts flag
salma2222 Aug 28, 2024
98a1e53
fix copyts flag
salma2222 Aug 28, 2024
8fc005e
Merge pull request #12856 from kaltura/Tucana-20.19.0-PLAT-24840-1
salma2222 Aug 28, 2024
e0722aa
VCP-18589: add 'updated_at' index to schemas
amiras89 Aug 28, 2024
e532074
FOUN-1911: Avoid fatal error when hosts in sphinx lag ky do not match…
yossipapi Aug 28, 2024
345cf6f
VCP-18577: when importing files, if no 'filesize' from headers defaul…
amiras89 Aug 28, 2024
7125ad6
Merge pull request #12859 from kaltura/Tucana-20.19.0-FOUN-1911
yossipapi Aug 28, 2024
d1df7b5
PLAT-24912: Move v2Redirect to be a plugin
MosheMaorKaltura Aug 28, 2024
ecb9813
PLAT-24912: redirect v2 to v7
MosheMaorKaltura Aug 28, 2024
7da53ac
Merge pull request #12847 from kaltura/Tucana-20.18.0-REACH2-1266
drorsou Aug 29, 2024
c016c3c
KME-2084: add templateRoomEntryId to RoomEntry
Amirhalfon1 Aug 29, 2024
320a53b
Pass default values for optional params before passing file to delete
yossipapi Aug 30, 2024
5cd239d
Merge pull request #12862 from kaltura/yossipapi-patch-7
yossipapi Aug 30, 2024
b20566d
CR changes - fix indent, handle receive of "0" and ""
Amirhalfon1 Sep 2, 2024
7e6270e
SUP-43308: Enable recycle bin will force enable scheduled task permis…
coralburg12 Sep 2, 2024
8363fa9
Merge pull request #12846 from kaltura/Tucana-20.18.0-REACH2-1267
drorsou Sep 2, 2024
0d45b6c
SUP-43308: Enable recycle bin will force enable scheduled task permis…
coralburg12 Sep 2, 2024
1a1e045
move logic to same if condition
amiras89 Sep 2, 2024
0f074f0
REACH2-1236: Moved code to kReachUtils
drorsou Sep 2, 2024
e9e85b3
Merge pull request #12861 from kaltura/Tucana-20.19.0-KME-2084
Amirhalfon1 Sep 2, 2024
f4b0f36
CR-19: Added eventSessionContextId to clips vendor task
rkreich Aug 19, 2024
60b74b3
SUP-43308: Enable recycle bin will force enable scheduled task permis…
coralburg12 Sep 2, 2024
5a0fb6e
Merge pull request #12850 from kaltura/Tucana-20.18.0-SUP-43987
amiras89 Sep 2, 2024
71ed3e0
Merge pull request #12858 from kaltura/Tucana-20.19.0-VCP-18589
amiras89 Sep 3, 2024
92ef0b7
REACH2-1235: Improved datepicker functionality
drorsou Sep 3, 2024
6d65a70
REACH2-1236: Renamed utility function
drorsou Sep 3, 2024
f15055c
add media repurposing metadata profile for enabling media repurposing…
salma2222 Sep 3, 2024
7f2f12c
Merge pull request #12860 from kaltura/Tucana-20.19.0-VCP-18577
amiras89 Sep 3, 2024
a6c457e
Merge pull request #12869 from kaltura/Tucana-20.19.0-PLAT-24928
salma2222 Sep 3, 2024
5c54398
Merge pull request #12844 from kaltura/Tucana-20.18.0-REACH2-1235
drorsou Sep 3, 2024
e67475a
Merge pull request #12845 from kaltura/Tucana-20.18.0-REACH2-1236
drorsou Sep 3, 2024
e66cff4
PLAT-24930: Add enum value "reels-player" to the ui-confs types
danbar0kal Sep 3, 2024
e6aee33
KME-2117: allow setting of templateRoomEntry from "global" partner
Amirhalfon1 Sep 4, 2024
0535a09
remove spaces
Amirhalfon1 Sep 4, 2024
5b56b26
remove spaces #2
Amirhalfon1 Sep 4, 2024
be6ceed
PLAT-24912: indentation
MosheMaorKaltura Sep 4, 2024
36c2789
REACH2-1284: Add fields to admin console for Partner Catalog Items
drorsou Sep 8, 2024
6ac5fc1
REACH2-1284: Fix whitespace
drorsou Sep 8, 2024
a2afa61
REACH2-1284: Fix tabs
drorsou Sep 8, 2024
398d5ce
PLAT-24937: Add Unisphere endpoint to KMC server config object
danbar0kal Sep 8, 2024
97d0906
PLAT-24930: fix readme
danbar0kal Sep 8, 2024
f4d027a
PLAT-24926: requireSource does not change from bulk CSV
drorsou Sep 8, 2024
6e72686
Merge pull request #12878 from kaltura/master-merge-Tucana-20.19.0
inbal-ben-david Sep 9, 2024
6fe8a38
Updated version - Tucana-20.20.0
inbal-ben-david Sep 9, 2024
5e1d436
Merge pull request #12879 from kaltura/Tucana-20.20.0-update-version
inbal-ben-david Sep 9, 2024
014f75f
Merge pull request #12875 from kaltura/Tucana-20.19.0-PLAT-24937-unis…
danbar0kal Sep 9, 2024
41f9952
Merge pull request #12842 from kaltura/Tucana-20.18.0-AN-23365
olampert Sep 9, 2024
1c9f97c
Merge pull request #12867 from kaltura/Tucana-20.19.0-CR-19-ContextId
rkreich Sep 9, 2024
69a72d3
Merge pull request #12870 from kaltura/Tucana-20.20.0-PLAT-24930-UiCo…
danbar0kal Sep 9, 2024
8950a45
Merge pull request #12873 from kaltura/Tucana-20.19.0-REACH2-1284
drorsou Sep 9, 2024
dd564fc
Merge pull request #12876 from kaltura/Tucana-20.19.0-PLAT-24926
drorsou Sep 9, 2024
905353e
PLAT-24926: Add Reach pricing per hour
drorsou Sep 9, 2024
573e049
Merge pull request #12880 from kaltura/Tucana-20.20.0-PLAT-24929
drorsou Sep 9, 2024
62b010b
PLAT-24940: Enable Content Lab feature
danbar0kal Sep 10, 2024
3aa0c0c
Merge pull request #12872 from kaltura/Tucana-20.19.0-KME-2117
Amirhalfon1 Sep 10, 2024
87d3e60
Merge pull request #12884 from kaltura/Tucana-20.20.0-PLAT-24940-Enab…
danbar0kal Sep 10, 2024
cc7ba7e
Merge pull request #12853 from kaltura/Tucana-20.18.0-SUP-44075
coralburg12 Sep 10, 2024
76cef4a
Merge pull request #12866 from kaltura/Tucana-20.19.0-SUP-43308
coralburg12 Sep 10, 2024
10f993a
SUP-43308: Correct function call name
drorsou Sep 11, 2024
3d43ea0
Merge pull request #12885 from kaltura/Tucana-20.19.0-SUP-43308-TypoFix
drorsou Sep 11, 2024
b1d3e78
PLAT-24937: unisphere uri fix
danbar0kal Sep 11, 2024
b85cd4c
Merge pull request #12886 from kaltura/Tucana-20.20.0-PLAT-24937-1
danbar0kal Sep 11, 2024
ab7ebc4
Merge remote-tracking branch 'origin/Tucana-20.20.0' into Tucana-20.1…
MosheMaorKaltura Sep 11, 2024
5e5d8b8
Update v2RedirectUtils.class.php
MosheMaorKaltura Sep 12, 2024
490fd66
Update v2RedirectUtils.class.php
MosheMaorKaltura Sep 12, 2024
dbe1517
Update embedIframeJsAction.class.php
MosheMaorKaltura Sep 12, 2024
8fd9b40
Update embedPlaykitJsAction.class.php
MosheMaorKaltura Sep 15, 2024
55e51b4
Update embedPlaykitJsAction.class.php
MosheMaorKaltura Sep 15, 2024
5d19c66
Update v2RedirectUtils.class.php
MosheMaorKaltura Sep 16, 2024
b21d86b
Update v2RedirectUtils.class.php
MosheMaorKaltura Sep 16, 2024
b3850e5
Update v2RedirectUtils.class.php
MosheMaorKaltura Sep 16, 2024
27c2322
Update KalturaUiConfV2Redirect.php
MosheMaorKaltura Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions alpha/apps/kaltura/lib/v2Tov7Utils.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php

class v2Tov7Utils
{
const V2TOV7_PARAM_NAME = 'v2tov7';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like all these v2tov7. why not have something more intuitive v7CompatibleId or something similar

const FLASHVARS_PARAM_NAME = 'flashvars';
const SHOULD_TRANSLATE_PLUGINS = self::V2TOV7_PARAM_NAME ."translate";

static private function getV7PluginInfo($v2PluginName): array
{
KalturaLog::log("Searching for " . $v2PluginName . " " . strlen($v2PluginName));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to print strlen here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed entire print message - needed only for debug

$translation = self::v2toV7PluginMap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not simply save the map as a static member of the class instead of doing a function call here?

If this could change you can even move it toa config (ini) file and load it using kConf to be able to change it without the need of pushing code changes for it.

if(isset($translation[$v2PluginName]))
{
$v7PluginInfo = $translation[$v2PluginName];
KalturaLog::log("Found " . print_r($v7PluginInfo, true));
return $v7PluginInfo;
}
else
{
throw new Exception ($v2PluginName);
}
}

static function addV2toV7plugins($flashvars, &$bundleConfig, &$playerConfig)
{
if(!$flashvars)
{
return;
}
$unHandledPlugins = array();

//Merge v7 config
foreach ($flashvars as $key => $value)
{
if(self::isVarPlugin($key))
{
//get plugin name
KalturaLog::log("V2 to V7 adding plugin: " . $key. " value:" . $value);
if ($value) {
if (!$bundleConfig) {
$bundleConfig = [];
}
$key = trim(trim($key, '"'), "'");
$v2PluginName = explode(".", $key);
try
{
$v7PluginName = self::getV7PluginInfo($v2PluginName[0]);
$bundleConfig = array_merge($bundleConfig, [$v7PluginName[0] => "{latest}"]);
$v7PluginConfig = $v7PluginName[1];
if (!isset($playerConfig->plugins)) {
$playerConfig->plugins = new stdClass();
}
if (!isset($playerConfig->plugins->$v7PluginConfig)) {
$playerConfig->plugins->$v7PluginConfig = new stdClass();
}
}
catch (Exception $e){
$unHandledPlugins[] = $e->getMessage();
}
}
}
}
if(sizeof($unHandledPlugins))
{
throw new Exception ("Unhandled plugins: " . implode(", ", $unHandledPlugins));
}
}

static function addV2toV7config($flashvars, $uiconfId)
{
$config = [];
//Merge v7 config

if($flashvars)
{ foreach ($flashvars as $key => $value) {
$key = trim(trim($key, '"'), "'");
$config[$key] = json_decode($value);
}
}
$config["uiconf_id"] = $uiconfId;
return $config;
}

private static function isVarPlugin($varKeyName)
{
return str_contains($varKeyName, ".plugin");
}

private static function v2toV7PluginMap()
{
return
["info" => ["playkitscreen", "playkit-js-info"],
"quiz" => ["playkit-ivq", "ivq"],
"moderation" => ["playkit-moderation", "playkit-js-moderation"],
"playlistAPI" => ["playkit-playlist", "playlist"],
"liveStatus" => ["playkit-kaltura-live","kaltura-live"],
"related" => ["playkit-related", "related"],
"dualScreen" => ["playkit-dual-screen", "dualscreen"],
"video360" => ["playkit-vr" ,"vr"],
"raptMedia" => ["rapt", "rapt"],
"transcript" => ["playkit-transcript", "playkit-js-transcript"],
"qna" => ["playkit-qna", "qna"],
"bumper" => [ "playkit-bumper" , "bumper" ],
"infoScreen" => ["playkit-info", "playkit-js-info"]];
}

public static function getBundledFacade()
{
//build key based on version
$facadeVersion = kConf::getArrayValue('v2tov7FacadeVersion','playkit-js');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the config for v2tov7FacadeVersion do you have another PR for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to go to local.ini

$facadeVersion .= "/v2tov7Facade.js";

//try get value from local memcache
$cacheStore = kCacheManager::getSingleLayerCache(kCacheManager::CACHE_TYPE_PLAYKIT_JS);
$bundledFacade = $cacheStore->get($facadeVersion);
if(strlen($bundledFacade))
{
return $bundledFacade;
}

//if not local - get it from remote location
$remoteUrl = kConf::getArrayValue('v2tov7FacadeRemoteUrl','playkit-js');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the config for v2tov7FacadeRemoteUrl do you have another PR for it?

$remoteUrl .= '/' . $facadeVersion;

$curlWrapper = new KCurlWrapper();

$content = $curlWrapper->exec($remoteUrl,null, null, true);
if(KCurlHeaderResponse::isError($curlWrapper->getHttpCode()))
{
throw new Exception ('Cannot find V2 to V7 facade in the following URL: ' . $remoteUrl . "Error code:" . $curlWrapper->getHttpCode());
}

//store in local cache for next time
$cacheStore->set($facadeVersion,$content);
return $content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function execute()

$ui_conf_html5_url = $uiConf->getHtml5Url();


if (array_key_exists($partner_id, $optimizedPlayback))
{
// force a specific kdp for the partner
Expand All @@ -61,6 +60,14 @@ public function execute()
$autoEmbed = $this->getRequestParameter('autoembed');

$iframeEmbed = $this->getRequestParameter('iframeembed');

//redirect the call to V7
if($uiConf->getV2tov7id() && ($this->getRequestParameter(v2Tov7Utils::V2TOV7_PARAM_NAME) || $uiConf->getV2tov7Approved()) )
{
$this->redirectToV7($uiConf->getV2tov7id(), $uiconf_id, $partner_id, $uiConf->getV2tov7ShouldTranslatePlugins() );
}


$scriptName = ($iframeEmbed) ? 'mwEmbedFrame.php' : 'mwEmbedLoader.php';
if($ui_conf_html5_url && $iframeEmbed) {
$ui_conf_html5_url = str_replace('mwEmbedLoader.php', 'mwEmbedFrame.php', $ui_conf_html5_url);
Expand Down Expand Up @@ -143,4 +150,44 @@ public function execute()
header("Location:$url");
KExternalErrors::dieGracefully();
}

/*
* v2 - https://cdnapisec.kaltura.com/p/1915851/sp/191585100/embedIframeJs/uiconf_id/32880931/partner_id/1915851?iframeembed=true&playerId=kaltura_player_1719900446&entry_id=1_aeg07vpv
* v7 - https://cdnapisec.kaltura.com/p/1915851/embedPlaykitJs/uiconf_id/54813242?iframeembed=true&entry_id=1_aeg07vpv
*/
private function redirectToV7($v7Id, $v2UiConfId, $partnerId, $shouldTranslatePlugins) : void
{
//validate all the params are handled
try
{
$config = array();
$config['bundleConfig'] = null;
$config['playerConfig'] = new stdClass();
v2Tov7Utils::addV2toV7config($this->getRequestParameter(v2Tov7Utils::FLASHVARS_PARAM_NAME),$v7Id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you calling this if you're not using the return value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it throws here it will be catched and redirect will be avoided.

if($shouldTranslatePlugins)
{
v2Tov7Utils::addV2toV7plugins(
$this->getRequestParameter(v2Tov7Utils::FLASHVARS_PARAM_NAME),
$config['bundleConfig'],
$config['playerConfig']);
}
//validate that the facade is reachable
v2Tov7Utils::getBundledFacade();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call this if you're not using the return value?
If only wanna check if the facade is reachable why not separate it to a different more light method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am checking here all parts that are essential to the redirect - a. translate plugins. b. add falsh vars. c. get facade, if one of them fails, then redirect will not happen

}
catch(Exception $e)
{
//if we failed, then should not redirect!
KalturaLog::log('V2toV7 was rejected because: ' . $e->getMessage() . ' v2 id:' . $v2UiConfId. ' v7 id:' . $v2UiConfId);
return;
}

$shouldTranslatePluginsQueryParam = $shouldTranslatePlugins ? '&' . v2Tov7Utils::SHOULD_TRANSLATE_PLUGINS . '=true' : '' ;
$host = myPartnerUtils::getCdnHost($partnerId, null , 'api');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with internal API URL for the machines that served embedPlaykitJs Action

$url = $host . '/p/' . $partnerId . '/embedPlaykitJs/uiconf_id/' . $v7Id . '?'
. $_SERVER['QUERY_STRING'] . "&"
. v2Tov7Utils::V2TOV7_PARAM_NAME .'=true'
. $shouldTranslatePluginsQueryParam;
header("Location:$url");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for returning redirect here?
What if the device won't follow the redirect?
Why not proxy it internally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our original design the redirect needs to be catched by the proxy gw

KExternalErrors::dieGracefully();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* @package Core
* @subpackage externalWidgets
Expand Down Expand Up @@ -68,6 +67,11 @@ public function execute()

$lastModified = $this->getLastModified($bundleContent);

if($this->getRequestParameter(v2Tov7Utils::V2TOV7_PARAM_NAME))
{
$bundleContent .= PHP_EOL . v2Tov7Utils::getBundledFacade();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You ar not checking the exception that might be thrown from getBundledFacade is this intended?

}

//Format bundle content
$bundleContent = $this->formatBundleContent($bundleContent, $i18nContent, $extraModulesNames);

Expand Down Expand Up @@ -498,23 +502,31 @@ private function getAutoEmbedCode($targetId = null)
$config["provider"]->uiConfId = $this->uiconfId;

$ks = $this->getRequestParameter(self::KS_PARAM_NAME);

if ($ks)
{
$config["provider"]->ks = $ks;
}

$config["targetId"] = $targetId;

$config = json_encode($config);
if ($config === false)
{
KExternalErrors::dieError(KExternalErrors::INVALID_PARAMETER, "Invalid config object");
}

$v2tov7ConfigJs='';
if($this->getRequestParameter(v2Tov7Utils::V2TOV7_PARAM_NAME))
{
$v2ToV7config = v2Tov7Utils::addV2toV7config($this->getRequestParameter(v2Tov7Utils::FLASHVARS_PARAM_NAME), $this->uiconfId);
$v2tov7ConfigJs = 'var v2toV7Config = window.v2tov7_buildConfigFromFlashvars(' . JSON_encode($v2ToV7config) . ');
config = {...config,...v2toV7Config};';
}

$autoEmbedCode = "
try {
var kalturaPlayer = KalturaPlayer.setup($config);
var config=$config;
$v2tov7ConfigJs
var kalturaPlayer = KalturaPlayer.setup(config);
$loadContentMethod
} catch (e) {
console.error(e.message);
Expand Down Expand Up @@ -543,7 +555,7 @@ private function getIfarmEmbedCode($bundleContent)
</head >
<body >
<div id="player_container"></div>
<script type = "text/javascript" > window.originalRequestReferrer = "' . $_SERVER['HTTP_REFERER'] . '"</script >
<script type = "text/javascript" > window.originalRequestReferrer = "' . @$_SERVER['HTTP_REFERER'] . '"</script >
<script type = "text/javascript" > ' . $bundleContent . '</script >
</body >
</html >';
Expand Down Expand Up @@ -576,6 +588,7 @@ private function mergeVersionsParamIntoConfig()
if (!$this->bundleConfig) {
$this->bundleConfig = array();
}
KalturaLog::log("versionsArr" . print_r($versionsArr,true));
$this->bundleConfig = array_merge($this->bundleConfig, $versionsArr);
}
}
Expand Down Expand Up @@ -813,6 +826,15 @@ private function initMembers()
}

$this->mergeVersionsParamIntoConfig();

if($this->getRequestParameter(v2Tov7Utils::V2TOV7_PARAM_NAME) && $this->getRequestParameter(v2Tov7Utils::SHOULD_TRANSLATE_PLUGINS))
{
v2Tov7Utils::addV2toV7plugins(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can throw exceptions, don't you need to handle it gracefully?

$this->getRequestParameter(v2Tov7Utils::FLASHVARS_PARAM_NAME),
$this->bundleConfig,
$this->playerConfig);
}

if (!$this->bundleConfig) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, "unable to resolve bundle config");
}
Expand All @@ -822,6 +844,8 @@ private function initMembers()
$this->setBundleName();
}



private function setBundleName()
{
//sort bundle config by key
Expand All @@ -843,5 +867,4 @@ public function getRequestParameter($name, $default = null)
$returnValue = parent::getRequestParameter($name, $default);
return $returnValue ? $returnValue : $default;
}

}
36 changes: 34 additions & 2 deletions alpha/lib/model/uiConf.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ class uiConf extends BaseuiConf implements ISyncableFile, IRelatedObject

const CUSTOM_DATA_CON_FILE_VERSION = 'conf_file_version';
const CUSTOM_DATA_CONF_FILE_FEATURES_VERSION = 'conf_file_features_version';

public function save(PropelPDO $con = null)

const CUSTOM_DATA_V2V7_ID = "v2v7_id";
const CUSTOM_DATA_V2V7_APPROVED = "v2v7_approved";
const CUSTOM_DATA_V2V7_TRANSLATE_PLUGINS = "v2v7_translate_plugins";

public function save(PropelPDO $con = null)
{
try
{
Expand Down Expand Up @@ -809,4 +813,32 @@ public function setVersion($v, $subType = self::FILE_SYNC_UICONF_SUB_TYPE_CONFIG

return parent::setVersion($v);
}

//v2 to v7
public function getV2tov7id()
{
return $this->getFromCustomData(self::CUSTOM_DATA_V2V7_ID, null, null);
}
public function setV2tov7id($v)
{
return $this->putInCustomData(self::CUSTOM_DATA_V2V7_ID, $v);
}
public function getV2tov7Approved()
{
$val = $this->getFromCustomData(self::CUSTOM_DATA_V2V7_APPROVED, null, false, null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the 4th param here? getFromCustomData get 3 params?
Same comment applies to "getV2tov7ShouldTranslatePlugins"

return ($val === 1 || $val === true || $val === "true");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you doing this instead of simply doing
return $this->getFromCustomData(self::CUSTOM_DATA_V2V7_APPROVED, null, false);

Same comment applies to "getV2tov7ShouldTranslatePlugins"

}
public function setV2tov7Approved($v)
{
return $this->putInCustomData(self::CUSTOM_DATA_V2V7_APPROVED, $v);
}
public function getV2tov7ShouldTranslatePlugins()
{
$val = $this->getFromCustomData(self::CUSTOM_DATA_V2V7_TRANSLATE_PLUGINS, null, false, null);
return ($val === 1 || $val === true || $val === "true");
}
public function setV2tov7ShouldTranslatePlugins($v)
{
return $this->putInCustomData( self::CUSTOM_DATA_V2V7_TRANSLATE_PLUGINS, $v );
}
}
25 changes: 22 additions & 3 deletions api_v3/lib/types/KalturaUiConf.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,24 @@ class KalturaUiConf extends KalturaObject implements IFilterable
* @filter mlikeor, mlikeand
*/
public $partnerTags;



MosheMaorKaltura marked this conversation as resolved.
Show resolved Hide resolved

/**
* @var string
*/
public $v2tov7id;

/**
* @var string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this bool?

*/
public $v2tov7Approved;

/**
* @var string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this bool?

*/
public $v2tov7ShouldTranslatePlugins;


private static $map_between_objects = array
(
"id" ,
Expand All @@ -181,8 +197,11 @@ class KalturaUiConf extends KalturaObject implements IFilterable
"updatedAt",
"html5Url",
"config",
"version",
"version",
"partnerTags",
"v2tov7id",
"v2tov7Approved",
"v2tov7ShouldTranslatePlugins"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to validate that those values are set only on V2 UCONF, and validate the each param comes after the ID

);

public function getMapBetweenObjects ( )
Expand Down