• Moving From Flash(swfobject.js) To HTML5

  • Help us to improve OpenKM! Be part of the Open Source Community.
Help us to improve OpenKM! Be part of the Open Source Community.
Forum rules: Please, before asking something see the documentation wiki or use the forum search function.
 #50835  by jllort
 
I checked the current code and seems in what will be version 6.3.10 we use html previewer. Take a look at Preview.class ( https://github.com/openkm/document-mana ... eview.java ). Look for this code section from line 252
Code: Select all
/**
	 * Set the media file to reproduce
	 *
	 * @param mediaUrl The media file url
	 */
	public void showMediaFile(String mediaUrl, String mimeType) {
		hideWidgetExtension();
		vPanel.clear();

		if (previewEvent != null) {
			vPanel.add(hReturnPanel);
			vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px");
		}

		vPanel.add(video);
		vPanel.setCellHorizontalAlignment(video, HasAlignment.ALIGN_CENTER);
		vPanel.setCellVerticalAlignment(video, HasAlignment.ALIGN_MIDDLE);

		this.mediaUrl = mediaUrl;
		Util.removeMediaPlayer();
		video.setHTML("<div id=\"mediaplayercontainer\"></div>\n");

		if (mimeType.equals("audio/mpeg")) {
			mediaProvider = "sound";
		} else if (mimeType.equals("video/x-flv") || mimeType.equals("video/mp4")) {
			mediaProvider = "video";
		} else if (mimeType.equals("application/x-shockwave-flash")) {
			mediaProvider = "";
		}

		Util.createMediaPlayer(mediaUrl, mediaProvider, "" + width, "" + height);
	}
I suggest this player https://www.mediaelementjs.com/
 #51051  by jllort
 
The idea behind the preview always is the same, embedded the content into an iframe ( or div ).

If you success previewing a document with download URL then you got it, basically using the right download URL to download the document from OpenKM ( because you are authenticated you should not worried about if the URL is protected or not ).

I suggest first do a jsp sample with static content ( static openkm download URL ) and when you got these pieces running then go ahead modifying Preview.java class and maybe some servlet

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.