Page 1 of 1

Moving From Flash(swfobject.js) To HTML5

PostPosted:Thu Nov 12, 2020 8:29 am
by jerry_tseng
Hi Team,

I would like to know how toUse html5 to play video instead of swfobject.js Embed flash.

Best Regards,

Re: Moving From Flash(swfobject.js) To HTML5

PostPosted:Sun Nov 15, 2020 7:26 am
by jllort
I can guide in the source code section you should modify. Do you have IT skills for doing it?
If you have not downloaded the personal development environment, please do it https://docs.openkm.com/kcenter/view/ok ... nment.html

Re: Moving From Flash(swfobject.js) To HTML5

PostPosted:Mon Nov 16, 2020 5:30 am
by jerry_tseng
Hi, I am it.
The OpenKM personal development environment is ready, how can I proceed?

Best Regards,

Re: Moving From Flash(swfobject.js) To HTML5

PostPosted:Sat Nov 21, 2020 6:57 pm
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/

Re: Moving From Flash(swfobject.js) To HTML5

PostPosted:Tue Nov 24, 2020 2:46 am
by jerry_tseng
Hi Jllort:

Thanks for your reply.
I would like to ask, I need to design an event listener in frontend/index.jsp? (Just like swfobject.js?)

Re: Moving From Flash(swfobject.js) To HTML5

PostPosted:Fri Nov 27, 2020 4:43 pm
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