Viewer SDK namespace viewer-sdk-namespace

The viewer is built of many Viewer SDK components. Usually, the web page does not need to interact with the SDK components API directly; all common needs are covered in the viewer API itself.

However, some advanced use cases require that the web page reference an inner SDK component using the getComponent() viewer API and then use all the flexibility of the APIs of SDK itself.

The namespace that is used to load and initialize SDK components by the viewer depends on the environment in which the viewer is operating. If the viewer is running in Adobe Experience Manager, the viewer loads SDK components into s7viewers.s7sdk namespace. Likewise, the viewer served from Dynamic Media Classic loads the SDK into s7classic.s7sdk.

In either case, the namespace used by the SDK inside the viewer has either s7viewers or s7classic as the prefix. And, it is different from the plain s7sdk namespace used in the SDK User Guide or SDK API documentation.

For that reason, it is important to use a fully qualified SDK namespace when you write custom application code that communicates with internal viewer components.

For example, if you plan to listen to StatusEvent.NOTF_VIEW_READY event and the viewer is served from Experience Manager, the fully qualified event type is s7viewers.s7sdk.event.StatusEvent.NOTF_VIEW_READY, and the event listener code looks similar to the following:

 "initComplete":function() {
  var videoPlayer = <instance>.getComponent("videoPlayer");
   videoPlayer.addEventListener(s7viewers.s7sdk.event.StatusEvent.NOTF_VIEW_READY, function(e) {
   console.log("view ready");
  }, false);