Expand my Community achievements bar.

SOLVED

Dynamic media smart crop video fails in smartcropvideo_sly.js

Avatar

Level 2

It's AACS.

 

We're using dynamic media and notice that when OOB smart crop video component is used inside another component (it could be simple proxy component without any business logic) by reference it using data-sly-resource, in that case oob smartcropvideo_sly.js fails when component is first time put on the page.

If same oob smart crop video cmp. is not  embedded inside another component, smartcropvideo_sly.js  doesn't fail.

We can see the same on localhost and on the cloud runtime.

 

<div data-sly-resource="${'video' @ resourceType='dam/components/scene7/smartcropvideo', decorationTagName='div'}"
></div>

 

We noticed that this line returns undefined in combination with data-sly-resource

var props = resource.adaptTo(org.apache.sling.api.resource.ModifiableValueMap);

 

Caused by: org.apache.sling.scripting.sightly.SightlyException: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "put" of undefined (/libs/dam/components/scene7/smartcropvideo/smartcropvideo_sly.js#189)
at org.apache.sling.scripting.sightly.js.impl.loop.EventLoop.run(EventLoop.java:71) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.loop.EventLoop.schedule(EventLoop.java:46) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.JsEnvironment.runScript(JsEnvironment.java:105) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.JsEnvironment.runScript(JsEnvironment.java:82) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.JsEnvironment.runScript(JsEnvironment.java:87) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.JsUseProvider.provide(JsUseProvider.java:98) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:71) [org.apache.sling.scripting.sightly:1.4.20.140]
... 194 common frames omitted
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "put" of undefined (/libs/dam/components/scene7/smartcropvideo/smartcropvideo_sly.js#189)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3951)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3929)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3962)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3981)
at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3998)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2414)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2407)
at org.mozilla.javascript.gen._libs_dam_components_scene7_smartcropvideo_smartcropvideo_sly_js_47._c_anonymous_1(/libs/dam/components/scene7/smartcropvideo/smartcropvideo_sly.js:189)
at org.mozilla.javascript.gen._libs_dam_components_scene7_smartcropvideo_smartcropvideo_sly_js_47.call(/libs/dam/components/scene7/smartcropvideo/smartcropvideo_sly.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3282)
at org.mozilla.javascript.gen._libs_dam_components_scene7_smartcropvideo_smartcropvideo_sly_js_47.call(/libs/dam/components/scene7/smartcropvideo/smartcropvideo_sly.js)
at org.apache.sling.scripting.sightly.js.impl.rhino.JsUtils.callFn(JsUtils.java:37) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.use.UseFunction.lambda$callImmediate$1(UseFunction.java:111) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.loop.Task.run(Task.java:36) [org.apache.sling.scripting.sightly.js.provider:1.2.8]
at org.apache.sling.scripting.sightly.js.impl.loop.EventLoop.run(EventLoop.java:61) [org.apache.sling.scripting.sightly.js.provider:1.2.8]

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@ukk62 have you tried using OOTB container comps like responsive grid or a carousel component and drag and drop manually this video comp from Editor view? if it is not working then it should be an issue, if not there should be an issue on how you are configuring a Container component and calling this subcomponent.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@ukk62 have you tried using OOTB container comps like responsive grid or a carousel component and drag and drop manually this video comp from Editor view? if it is not working then it should be an issue, if not there should be an issue on how you are configuring a Container component and calling this subcomponent.