Jump to content

notification.mp3


Adlago

Recommended Posts

I'm launching this topic with the idea, team developer to consider this resource.
What do I mean:
- This is a secondary resource - it is used in certain cases.
- This resource provides between 400 and 600 milliseconds delay in the loading site, meaning loading this resource from a browser starts with a delay that is caused by the logic you have entered in the processing of notifications.
- This resource is not required for guest visitors.

@Rikki - yes, sound in logged  user is preload

* Author: Rikki Tissier
 */

;( function($, _, undefined){
	"use strict";
	
	ips.createModule('ips.utils.notification', function () {

		var supported = ( "Notification" in window );
		var sound = null;

		// Preload our notification sound
		if( !ips.getSetting('disableNotificationSounds') ){
			sound = new Howl({
			    src: ips.getSetting('baseURL') + 'applications/core/interface/sounds/notification.mp3',
			    autoplay: false
			});
		}

but, when a logged user receives a notification...

For Guests this resource is useless. Even harmful if you look at a place to load time.
This resource at initial loading site extends DOM loaded to CSS and JS (h2 protocol) by approximately 400-600 milliseconds.

Analysis of sites publishing ads valuing ads is done by bot machines that evaluate as Guests ...

This delay causes a loss of money for your clients using the IPS Suite and publishing ads.

In my analysis, the process of loading a notification.mp3  is initialized by howler.core.mine.js , after which this sound request is retrieved from a root_framework.js  and after permissions analysis, and I still do not know what is hard to determine how many more checks are allowed on a browser to load this little size of mp3.
There is something stupid - with an excuse for the phrase, in this decision for this mp3.
Please reconsider it and find a better solution to help, not to make a delay.

I'm not sure, but maybe it's good to load it after  time  'onload', it makes no sense that it could slow DOM loaded time.

 

Link to comment
Share on other sites

  • 4 weeks later...

What I can not understand - please comment.
notification.mp3  is initiated by the howler.core.min.js, loading is a task of the framework.js.

46567512_Screenshotat2019-04-22234126.thumb.png.b32d3d253ec0d7db5a5f85e0d7369bac.png
That's good, but why does the start notification.mp3 download request lag behind by more than 600 milliseconds from the end downloading framework.js?

63627160_Screenshotat2019-04-22234228.thumb.png.fc7b420156505e1e98130fd3c1bea4ea.png

 

If this process does not speed up, then what is the best way to get this resource "preload"?

Link to comment
Share on other sites

If I am understanding correctly, this is the notification IPS uses if a user allows browser notifications?

If that's the case, then it would only affect users who allowed notifications from your site, correct (registered users or otherwise)?

Link to comment
Share on other sites

3 minutes ago, Joy Rex said:

If I am understanding correctly, this is the notification IPS uses if a user allows browser notifications?

If that's the case, then it would only affect users who allowed notifications from your site, correct (registered users or otherwise)? 

It should be so - but this mp3 is being loaded by every guest and this is a slow loading site. So I'm looking for a solution.

Link to comment
Share on other sites

So the MP3 is loading regardless of whether the user enables browser notifications?

That's not very efficient, but it may be the only way to allow users to enable notifications or not...

I'm assuming the MP3 itself is small - if not, you could potentially find the file on the server and reduce the size of it further without compromising the sound quality using an online compression utility.

Link to comment
Share on other sites

13 minutes ago, Joy Rex said:

So the MP3 is loading regardless of whether the user enables browser notifications?

That's not very efficient, but it may be the only way to allow users to enable notifications or not...

I'm assuming the MP3 itself is small - if not, you could potentially find the file on the server and reduce the size of it further without compromising the sound quality using an online compression utility. 

The file is small. But the whole possible action of this notification is a complicated process and calculation from a browser delayed loading site. IPS needs to find another solution.
Here, look at the entire code that a browser needs to process before downloading m3 ...

 

(function($,_,undefined){"use strict";ips.createModule('ips.utils.notification',function(){var supported=("Notification"in window);var sound=null;if(!ips.getSetting('disableNotificationSounds')){sound=new Howl({src:ips.getSetting('baseURL')+'applications/core/interface/sounds/notification.mp3',autoplay:false});}
var hasPermission=function(){if(!supported||Notification.permission=='denied'||Notification.permission=='default'){return false;}
return true;},needsPermission=function(){if(supported&&Notification.permission=='default'){return true;}
return false;},permissionLevel=function(){if(!supported){return null;}
return Notification.permission;},requestPermission=function(){if(supported){Notification.requestPermission(function(result){if(result=='granted'){$(document).trigger('permissionGranted.notifications');}else{$(document).trigger('permissionDenied.notifications');}});}},create=function(options){return new notification(options);},playSound=function(){try{if(!ips.getSetting('disableNotificationSounds')){sound.play();}}catch(err){}};function notification(options){this._notification=null;this._options=_.defaults(options,{title:'',body:'',icon:'',timeout:false,tag:'',dir:$('html').attr('dir')||'ltr',lang:$('html').attr('lang')||'',onShow:$.noop,onHide:$.noop,onClick:$.noop,onError:$.noop});this._options.body=_.unescape(this._options.body.replace(/&#039;/g,"'").replace(/<[^>]*>?/g,''));this._options.title=_.unescape(this._options.title.replace(/&#039;/g,"'"));this.show=function(){this._notification=new Notification(this._options.title,this._options);this._notification.addEventListener('show',this._options.onShow,false);this._notification.addEventListener('hide',this._options.onHide,false);this._notification.addEventListener('click',this._options.onClick,false);this._notification.addEventListener('error',this._options.onError,false);if(this._options.timeout!==false){setTimeout(_.bind(this.hide,this),this._options.timeout*1000);}};this.hide=function(){this._notification.close();this._notification.removeEventListener('show',this._options.onShow,false);this._notification.removeEventListener('hide',this._options.onHide,false);this._notification.removeEventListener('click',this._options.onClick,false);this._notification.removeEventListener('error',this._options.onError,false);};};return{supported:supported,hasPermission:hasPermission,needsPermission:needsPermission,permissionLevel:permissionLevel,requestPermission:requestPermission,create:create,playSound:playSound};});}(jQuery,_));

 

These are 600 milliseconds that delay any site, not just mine.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...