Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Page Properties
hiddentrue
idDONE

Product Version
Report Notepublished, language check outstanding
AssigneeKolibri

Resources & Remarks

https://wiki.optimal-systems.de/display/devkolibri/yuuvis+Momentum+-+Flex+Viewer+Service

There is description for extending the viewer service mentioned to be existing in git (ask Jürgen) - however, the link is missing. Get that documentation and cast it into a tutorial article linked to this viewer service concept article!

The link pointing to the "freely available" viewer components, also meant to be in git, is also inoperable or not accessible to anyone outside of team kolibri... → grab and integrate that info.

Supported filetypes look nicer when in tables:

Audio

Used component: By default audio files are natively played by the Browser with HTML5 Audio. (that is a subject of the HTML5 Audio specification).

Default component: Used component.
Mimetype: mpeg, mp3, ogg, wav
All played files are streamed to prevent unnecessary data downloads. The autoplay is set to false.

The API description lacks information...

These sentences are somewhat confusing and should be checked with the PO:
Additionaly, non mandatory parameters are provided (corresponding to the client settings)

  • bla
  • bla

Additionally provided parameters will be passed to the custom viewer. (I believe this should read: any further parameters provided will be passed to the custom viewer)


Place links for further reading at the bottom (api-gateway, functional extension - client side, architecture, a still-to-be-written customization tutorial)

A tutorial, describing how to integrate the viewer service into an Angular application ist missing.


Modification History

NameDateProduct VersionAction
Martin04 APR 20239.0Copied from yuuvis Momentum page





...

Used component: By default, audio files are natively played by the browser with HTML5 audio (that is a subject of the HTML5 Audio specification).

Default component: Used component.

Mimetype: mpeg, mp3, ogg, wav

...

Used component: Custom Angular Application with angular-x-image-viewer plug-in.

Default component: By default, the supported mimeTypes are rendered in the standard HTML img tag.

Mimetypes: jpeg, gif, png, svg, bmp, ico

...

Used component: Native image rendering as base64 encoded.

Default component: By default, the supported mimeTypes are rendered in the standard HTML img tag.

Mimetypes: tiff, tif

JSON

Used component: Custom Angular application with ngx-json-viewer plugin.

Default component: Used component.

Mimetype: application/json 

...

Used component: eml files are parsed by mailparser, msg files are parsed by custom parser inspired by (msgreader)

Default component: Used component.

Mimetypes : message/rfc822 (eml), beginning with 2021 Winter Alpha2: application/vnd.ms-outlook (msg)

...

Used component: Custom React application with markdown-to-jsx plug-in. / Custom Angular application withshowdown plug-in.

Default component: Used component.

Mimetypesx-web-markdownmarkdown

...

Used component: Files are parsed and rendered with https://webodf.org/

Default component: Used component.

File extension: odt, ods, odp

Mimetypes: application/zip (as resolved by yuuvis core service)

...

Used component: By default, plain text is natively rendered by the Browser.

Default component: Used component.

Mimetypesplain

XML(text/xml)

Used component: By default xml is natively rendered as text by the Browser.

Default component: Used component.

Mimetypes: xml

PDF

Used component: PDF.js which is a Mozilla project.

Default component: Used component.

Mimetypes: application/pdf

...

Used component:  By default video files are natively played by the browser with HTML5 Video (that is a subject of the HTML5 Video specification).

Default component: Used component.

Mimetypes: mpeg, mp4, ogg, webm

...

Used component: Native string rendering

Default component: Used component.

Mimetype: x-zip-compressed, zip

The content of the zip container is read and the name and paths are printed out.

Customizing

The viewer - service can be extended as described in this section.

Localization

...

Integration into 3rd party application

If the Viewer-Service runs in a different domain than the application that integrates it the Argus-Service has to be configured. In the file servicewatcher-sw.yml the parameter 'env' lists the parent domain has to be added as follows:

Code Block
titleSetting the localization strings in the language file of the client
en.json- name: viewerservice
  "yuv.viewer.not.authorized".
  env:
"Not  authorized to preview file.",
 "yuv.viewer.not.found": "File not found.",  ALLOWED_ORIGIN: http://myhost.com,http://myotherhost.com


Localization

The viewer-service offers a few strings with information for your users. They are part of the localization files en.json and de.json of the client.

Code Block
titleSetting the localization strings in the language file of the client
en.json :
 "yuv.viewer.not.supportedauthorized": "Format Not authorized to preview file.",
 "yuv.viewer.not.found": "File not found.",
 "yuv.viewer.not.supported": "Format not supported.",
 "yuv.viewer.not.supported.download.content": "Unable to display format. You can click this link to download the file."

de.json :
  "yuv.viewer.not.authorized": "Fehlende Authorisierung zur Anzeige der Datei.",
  "yuv.viewer.not.found": "Datei nicht gefunden.",
  "yuv.viewer.not.supported": "Dieses Format ist nicht unterstützt.",
  "yuv.viewer.not.supported.download.content": "Dieses Format kann nicht angezeigt werden. Ein Klick auf den Link lädt die Datei herunter."

...

Custom Viewer Configuration

The use of the viewer-service components can be extended by adding a few lines to its configuration.in the client configuration file main.json. The following configuration shows the default configuration used by the client:

Code Block
titleClient standard configuration for the viewer-service
"preview": {
  "viewers": [
    {
      "mimeType": ["application/json", "text/json", "text/plain", "text/xml", "text/java", "text/javascript", "application/javascript", "text/html", "text/markdown", "text/x-web-markdown", "text/x-markdown"],
      "viewer": "viewer/view/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
    },
    {
      "mimeType": ["audio/mp3", "audio/webm", "audio/ogg", "audio/mpeg", "video/mp4", "video/webm", "video/ogg", "application/ogg"],
      "viewer": "viewer/view/api/video/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
    },
    {
      "mimeType": ["image/tiff","image/jpeg", "image/png", "image/apng", "image/gif", "image/svg+xml", "image/webp"],
      "viewer": "viewer/view/api/img/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
    },
    {
      "mimeType": ["message/rfc822", "application/vnd.ms-outlook"],
      "viewer": "viewer/view/api/mail/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
    }
  ]
}
  • mimeType may also be a string Array, containing multiple mime types
  • viewer defines the internal viewing component to be used as there are monaco (see: https://microsoft.github.io/monaco-editor/), video, img, and mail. All URL parameters are necessary for the client so that it can find the document file (path), and show the correct language labels as well as the theme that is configured by the user. 

Example for the viewing of markdown-formatted files via an external viewing component:

Code Block
languagejava
titleextending the configuration
linenumberstrue
"preview": {
  "viewers": [
    {
      "mimeType": "text/x-web-markdown",
      "fileExtension": ["md"]
      "viewer": "{pathtoapplicationindex.html}?path=${path}#locale=${locale}&direction=${direction}&theme=${theme}&accentColor=${accentColor}"
    }
]

...

  ]
}

Additionally, non-mandatory parameters are provided (corresponding to the client settings)

...