Moving From Flash(swfobject.js) To HTML5

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.
Post Reply
jerry_tseng
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 02, 2018 2:34 am

Moving From Flash(swfobject.js) To HTML5

Post by jerry_tseng »

Hi Team,

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

Best Regards,
jllort
Moderator
Moderator
Posts: 11286
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

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

Post 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
jerry_tseng
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 02, 2018 2:34 am

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

Post by jerry_tseng »

Hi, I am it.
The OpenKM personal development environment is ready, how can I proceed?

Best Regards,
jllort
Moderator
Moderator
Posts: 11286
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

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

Post 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/
jerry_tseng
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 02, 2018 2:34 am

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

Post 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?)
jllort
Moderator
Moderator
Posts: 11286
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

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

Post 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
Post Reply