Download
(39 Kb)
Download
Updated: 01/29/24 01:29 PM
Compatibility:
Endless Archive (9.2.5)
Updated:01/29/24 01:29 PM
Created:03/13/14 10:38 PM
Monthly downloads:45,030
Total downloads:2,598,751
Favorites:988
MD5:
Categories:Libraries, Game Controller
LibMediaProvider  Popular! (More than 5000 hits)
Version: 1.0 r28 - beta
by: psypanda, ArtOfShred, Calamath, Seerah
LibMediaProvider is inspired by and borrows from LibSharedMedia-3.0, written for World of Warcraft.

This library facilitates the sharing of media (fonts, textures, etc) between addons. An addon can register media with LibMediaProvider, which then turns around and provides that media to any addon requesting media of that type.

LibMediaProvider is also available on GitHub.

Things To Know:
  • The "None" option for borders/backgrounds was removed, as ESO displays a white default texture if no file path is provided. Addons should handle hiding borders/backgrounds on their own through the alpha channel.
  • ESO currently does not support addon custom sounds to the game. Some sounds from the default UI have been provided as choices for your addons to use.
  • Label:SetFont("font") may be used with more than just a pre-defined font from the default UI. It may also take a string that is a combination of a file path, font size, and font style.
    Ex: label:SetFont("MyAddon/Font/path.ttf|18|soft-shadow-thin")
  • There is currently only one statusbar texture in the game. If you wish to have access to more, they must be provided and registered by an addon.
  • Currently supported media types: background, border, font, statusbar, sound
API Documentation:

:Register(mediatype, key, data)
Registers a new handle of given type.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
key
string - the handle to get the data from the lib
data
string - the data to associate with the handle; normaly a filename
Returns
boolean - false if data for the given mediatype-key pair already existes, true else
:Fetch(mediatype, key)
Fetches the data for the given handle and type.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
key
string - the handle to get the data from the lib
Returns
string or nil - the data for the given handle or nil
:IsValid(mediatype [, key])
Checks if the given type (and handle) is valid.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
[key]
string - the handle of the data
Returns
boolean - true if the type (and handle) is valid
:HashTable(mediatype)
Gets a hash table {data -> handle} to eg. iterate over.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
table - hash table for the given type
:List(mediatype)
Gets a sorted list of handles.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
table - list of handles for the given type
:GetDefault(mediatype)
Returns the default return value for nonexistant handles.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
string or nil - default return value for nonexistant handles for the given type
:SetDefault(type, handle)
Sets a default return value for nonexistant handles. Won't replace an already set default.
Arguments
type
string - the type of the data, eg. font or statusbar
handle
string - the handle of the data
Returns
none
Callback:

LibMediaProvider_Registered
fires when a new handle was successfully registered
Argumentss
name
"LibSharedMedia_Registered"
mediatype
the type of the new handle
key
the name of the handle
Predefined Data:
Media from the default UI of the 5 main types is already pre-registered with the library.
1.0 r28 (Calamath)
- Advance preparation for new text rendering system on PTS and guaranteed backward compatibility.

1.0 r27 (Calamath)
- Updated API version to 101040 (ESO 9.2.x : Update 40)

1.0 r26 (Calamath)
- Updated predefined fonts for EsoKR Ver.10.08 or later. (thanks Sharlikran)
- Added support for TurkishScrollsOnline add-on. (thanks Sharlikran)

1.0 r25 (Calamath)
- Updated API version to 101039 (ESO 9.1.x : Update 39)

1.0 r24 (Calamath)
- Fixed an issue where the MediaType table was not bypassed.

1.0 r23 (Calamath)
- Revamped the add-on framework for future extensions of the add-on API.
- Addressed a potential vulnerability issue where the internal media table could be overwritten by direct access.
- Excluded support for EsoZH add-on.
- Updated API version to 101038 (ESO 9.0.x : Necrom)

1.0 r22 (Calamath)
- Simplified Chinese language mode support.
- Temporarily excluded support for EsoZH.
- Added embedded Chinese fonts as predefined fonts.
- Some tweaks to backup font.
- Updated API version to 101036 (ESO 8.2.x : Firesong)

1.0 r21 (Calamath)
- Added embedded Japanese fonts as predefined fonts.
- Changed default font from Univers 55 to Univers 57
- Compatibility and support for unofficial language mod add-ons, EsoBR, Cervanteso, Italian Scrolls Online, EsoKR, Skrybowie Tamriel, EsoUA and EsoZH.
- Updated API version to 101035 (ESO 8.1.x : Lost Depths)

1.0 r20 (Calamath)
- Removed references and uses of LibStub completely.
- Updated API version to 101034 (ESO 8.0.x : High Isle)

1.0 r19 (Calamath)
- Updated API version to 101033 (ESO 7.3.x : Ascending Tide)

1.0 r18 (ArtOfShred)
- Updated API version for Blackwood.

1.0 r17 (ArtOfShred)
- Updated API version for Flames of Ambition.

1.0 r16 (ArtOfShred)
- Updated API version for Markarth.

1.0 r15 (ArtOfShred)
- Updated API version for Stonethorn.

1.0 r14 (ArtOfShred)
- Updated the font media table to properly support backup fonts for languages with missing glyphs not included in Western fonts, thanks to the efforts of Calamath!

1.0 r13 (ArtOfShred)
- LMP now functions without LibStub but supports loading in with LibStub for compatibility.
- LMP no longer includes an embedded LibStub. For older addons that may still require LibStub you will have to manually download it.

1.0 r12 (ArtOfShred)
- Embedded LibStub for dependency
- LMP wasn't working without LibStub so no longer creates an empty table if LibStub is not loaded

1.0 r11 (psypanda)
- Fix nested folders on zip creating (oopsie)

1.0 r10 (psypanda)
- LibMediaProvider works now with and w/o LibStub

1.0 r9 (psypanda)
- updated API version number to 100027
- added IsLibrary directive to manifest
- added global variable "LibMediaProvider" for direct access without using LibStub

1.0 r8 (Garkin)
- updated API Version number to 100011
- updated fonts for patch 1.6

1.0 r7 (Seerah)
- updated API Version number to 100010
- removed fonts that are no longer contained in the game files (they have been added to the MediaStash addon, however)
- changed default font from Arial Narrow (removed) to Univers 55

1.0 r6 (Seerah)
- preserve externally registered media types through library upgrades

1.0 r5 (Seerah)
- preserve externally registered media through library upgrades

1.0 r4 (Seerah)
- changed file path for solid textures to "" (since ESO treats an empty path as a solid color)
- updated LibStub.lua

1.0 r3 (Seerah)
- fixed bug where default handle was not returned if handle provided in :Fetch() was not found

1.0 r2 (Seerah)
- changed the default for backgrounds and borders since I removed the "none" option
Archived Files (27)
File Name
Version
Size
Uploader
Date
1.0 r27
21kB
Calamath
10/30/23 01:49 AM
1.0 r26
21kB
Calamath
07/30/23 09:16 AM
1.0 r25
21kB
Calamath
07/30/23 03:35 AM
1.0 r24
21kB
Calamath
05/20/23 11:39 PM
1.0 r23
21kB
Calamath
05/20/23 09:59 PM
1.0 r22
20kB
Calamath
11/06/22 09:56 PM
1.0 r21
20kB
Calamath
10/27/22 07:38 AM
1.0 r20
16kB
Calamath
06/08/22 12:28 PM
1.0 r19
16kB
Calamath
04/14/22 03:18 AM
1.0 r18
15kB
ArtOfShred
05/31/21 11:48 AM
1.0 r17
15kB
ArtOfShred
03/07/21 07:15 PM
1.0 r16
15kB
ArtOfShred
11/01/20 07:30 PM
1.0 r15
15kB
ArtOfShred
08/24/20 01:04 AM
1.0 r14
15kB
ArtOfShred
05/19/20 08:19 PM
1.0 r13
14kB
ArtOfShred
03/03/20 05:45 PM
1.0 r12
4kB
ArtOfShred
05/21/19 05:49 AM
1.0 r11
3kB
psypanda
05/20/19 01:30 AM
1.0 r10
3kB
psypanda
05/19/19 03:49 PM
1.0 r9
4kB
psypanda
05/02/19 03:58 PM
1.0 r8
4kB
Garkin
02/23/15 08:41 PM
1.0 r7
4kB
Seerah
11/06/14 11:13 PM
1.0 r6
4kB
Seerah
07/20/14 08:02 PM
1.0 r5
4kB
Seerah
07/17/14 08:49 PM
1.0 r4
4kB
Seerah
07/13/14 09:26 PM
1.0 r3
4kB
Seerah
03/15/14 01:29 PM
1.0 r2
4kB
Seerah
03/14/14 07:26 PM
1.0 r1
4kB
Seerah
03/13/14 10:38 PM


Post A Reply Comment Options
Unread 04/13/22, 08:50 PM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 36
File comments: 220
Uploads: 7
Release note:

Announcement:
I have taken over the maintenance of the LibMediaProvider add-on and the GitHub repository from ArtOfShred.
We appreciate his contribution over the years.
I will start providing live updates from now on.

[Update41:]
If you are experiencing a situation where the game freezes when displaying CJK Fonts,
we recommend temporarily turning OFF multi-threaded rendering in the graphic settings.
This is a vanilla UI issue.


- Calamath

Planned changes:
  • Migration to new UI font rendering system to be introduced in Update 41. [V1.0 r29]
    Version 1.0 r28.beta for testing and tuning until further notice. [UPDATED]
Recent changes:
  • Complete removal of LibStub library. [V1.0 r20]
  • Change default font media to 'Univers 57'. [V1.0 r21]
  • Media table security. [V1.0 r23]
    - Cases of other add-ons directly rewriting and breaking the media table of this add-on.
    Make it impossible to do these things.
    Lua Code:
    1. local LMP = LibMediaProvider
    2. LMP.MediaTable.font["Univers 57"] = nil
  • Unofficial Language Add-on Support. [V1.0 r21]
    - Instead, create a dedicated media table for unofficial language modes.
    Thus, authors of some unofficial language add-ons may need to let me know the exact full pathname of the font.
    In that case, please write it together with the two letters that represent the language mode.


Instructions for add-on authors:

[COMPATIBILITY-BREAKING CHANGE]
As of version 1.0 r20, LibStub is no longer used.
Instead, please use the global variable LibMediaProvider for direct access to the library.

Therefore, it is necessary to rewrite as follows.

Lua Code:
  1. -- YOUR OLD ADD-ON CODE
  2. -- before
  3. local LMP = LibStub:GetLibrary("LibMediaProvider-1.0")
  4.  
  5. -- after
  6. local LMP = LibMediaProvider
Last edited by Calamath : 03/13/24 at 09:43 PM.
Report comment to moderator  
Reply With Quote
Unread 03/13/24, 03:18 AM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 36
File comments: 220
Uploads: 7
Notice of postponement of r29 update.

As you know, we have moved to the new UI font rendering system with Update 41.

The LibMediaProvider add-on does not provide slug font files, but I believe the recently released r28 will continue to work reliably.
As for r29, I will wait for the unofficial language add-ons to support Update 41.

- Calamath
Last edited by Calamath : 03/13/24 at 09:29 PM.
Report comment to moderator  
Reply With Quote
Unread 03/11/24, 11:16 PM  
jebbrown

Forum posts: 0
File comments: 15
Uploads: 0
inventory insight broken

I just redownloaded both inventory insight and the newest libmedia provider and it is working fine now. I have no Idea what I did wrong, but it is working well now, so thanks to everyone who contributed to this wonderful addon.

--------------

This did not happen on my machine, and Inventory Insight ceased to function now that update 41 is out . I just wanna cry - can't function without inventory insight

This was updated by Minion, I hope it did properly delete old folder and extracted new files (did not check your zip file ), else forgive me!

Edit: Just in case, checked the zip file:
[/quote]

Hi Baertram.
I figured you would notice, but they are intentionally left in.
r28.x is a beta version and the add-on configuration is temporary.
Redundancy, as clunky as it is, but save me from time to time.

On the day Update 41 is published, the contents of the 101041 folder will overwrite the parent directory and subfolders will be deleted. [/quote]
Last edited by jebbrown : 03/12/24 at 03:51 AM.
Report comment to moderator  
Reply With Quote
Unread 01/31/24, 12:19 AM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 36
File comments: 220
Uploads: 7
Originally Posted by Baertram
Hey Calamath,

your API 101040 (current live) and API101041 zip file also contaisn old files still in the main folder which never get used anymore, right?


ttx file at least does not load them anymore:
Code:
$(APIVersion)/fontstrings_shared.xml
$(APIVersion)/backupfont_$(language).xml
$(APIVersion)/LibMediaProvider-1.0.lua
This was updated by Minion, I hope it did properly delete old folder and extracted new files (did not check your zip file ), else forgive me!

Edit: Just in case, checked the zip file:
Hi Baertram.
I figured you would notice, but they are intentionally left in.
r28.x is a beta version and the add-on configuration is temporary.
Redundancy, as clunky as it is, but save me from time to time.

On the day Update 41 is published, the contents of the 101041 folder will overwrite the parent directory and subfolders will be deleted.
Last edited by Calamath : 01/31/24 at 01:09 AM.
Report comment to moderator  
Reply With Quote
Unread 01/30/24, 01:59 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4903
File comments: 5974
Uploads: 78
Hey Calamath,

your API 101040 (current live) and API101041 zip file also contaisn old files still in the main folder which never get used anymore, right?


ttx file at least does not load them anymore:
Code:
$(APIVersion)/fontstrings_shared.xml
$(APIVersion)/backupfont_$(language).xml
$(APIVersion)/LibMediaProvider-1.0.lua
This was updated by Minion, I hope it did properly delete old folder and extracted new files (did not check your zip file ), else forgive me!

Edit: Just in case, checked the zip file:
Last edited by Baertram : 01/30/24 at 02:01 PM.
Report comment to moderator  
Reply With Quote
Unread 05/21/23, 01:55 AM  
ApoAlaia

Forum posts: 6
File comments: 136
Uploads: 0
Originally Posted by Calamath
Originally Posted by ApoAlaia
Good morning beautiful people.

Just a quick heads up, after installing the latest version (r23) both LUI Extended and Master Merchant threw errors and failed to initialise.

It might be that those addons need updates to accommodate the changes, not really sure (although hoping that's not the case because LUI Extended is no longer being actively developed or maintained).

I have reverted to r22 for now.
Thanks for the report, fixed in r24. Hope it works. ;-)
It does \o/

Well that was a quick turnaround, thank you!

Bonus relief that we can carry on using LUI Extended. Phew.
Report comment to moderator  
Reply With Quote
Unread 05/20/23, 11:41 PM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 36
File comments: 220
Uploads: 7
Originally Posted by ApoAlaia
Good morning beautiful people.

Just a quick heads up, after installing the latest version (r23) both LUI Extended and Master Merchant threw errors and failed to initialise.

It might be that those addons need updates to accommodate the changes, not really sure (although hoping that's not the case because LUI Extended is no longer being actively developed or maintained).

I have reverted to r22 for now.
Thanks for the report, fixed in r24. Hope it works. ;-)
Report comment to moderator  
Reply With Quote
Unread 05/20/23, 11:27 PM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 36
File comments: 220
Uploads: 7
Re: Latest update API changes stop LUI from loading successfully

Originally Posted by immediacy
Hello,

I updated LMP and noticed it caused LUI to crash fatally on load. I've traced it to this line, and wondered if anyone had a proposed hotfix in the new LMP API for how to correct this code.

Code:
for _, f in pairs(LMP:List(LMP.MediaType.FONT)) do
        if not LUIE.Fonts[f] then
            LUIE.Fonts[f] = LMP:Fetch(LMP.MediaType.FONT, f)
        end
    end
Thanks for the report, fixed in r24. Hope it works. ;-)
Last edited by Calamath : 05/20/23 at 11:47 PM.
Report comment to moderator  
Reply With Quote
Unread 05/20/23, 10:40 PM  
immediacy

Forum posts: 0
File comments: 3
Uploads: 0
Latest update API changes stop LUI from loading successfully

Hello,

I updated LMP and noticed it caused LUI to crash fatally on load. I've traced it to this line, and wondered if anyone had a proposed hotfix in the new LMP API for how to correct this code.

Code:
for _, f in pairs(LMP:List(LMP.MediaType.FONT)) do
        if not LUIE.Fonts[f] then
            LUIE.Fonts[f] = LMP:Fetch(LMP.MediaType.FONT, f)
        end
    end
Report comment to moderator  
Reply With Quote
Unread 05/20/23, 10:37 PM  
ApoAlaia

Forum posts: 6
File comments: 136
Uploads: 0
Good morning beautiful people.

Just a quick heads up, after installing the latest version (r23) both LUI Extended and Master Merchant threw errors and failed to initialise.

It might be that those addons need updates to accommodate the changes, not really sure (although hoping that's not the case because LUI Extended is no longer being actively developed or maintained).

I have reverted to r22 for now.
Report comment to moderator  
Reply With Quote
Unread 05/19/20, 08:22 PM  
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view AddOns

Forum posts: 103
File comments: 792
Uploads: 2
Re: Improvements to support the backup font feature

Originally Posted by Calamath
Hi, this is Calamath.
Before making a pull request, I'll post this for improvements to support the new backup fonts feature.

>Backup Font
It is the function to specify the fallback font file in GuiXML for each font, introduced in update 25.
In other words, it is a function to search for missing glyphs not included in Western fonts from another file.

Unfortunately, the behavior of fallback fonts has changed since update 25, and the default fallback font is gone.
At least if you specify a font filename with SetFont method, the fallback font feature doesn't seem to work properly.

Therefore, some add-ons using LibMediaProvider have a problem that localized Japanese text is not displayed correctly in Japanese language mode.
This is a niche issue, but I wanted to solve it so that it would not affect users who only use Western fonts.

so, I forked recent version and made a patch on my github repository.
I would be happy if you could check it in your spare time.


[modifiation details]
I modified the font media table of LibMediaProvider and defined a font string like '$(MEDIUM_FONT)' for western font files embedded in ESO.
This is because the backup font cannot be directly linked to the font filename at this time.

In the patched version, the optional definitions of backup fonts will only be loaded in two language modes, jp and ru.
Therefore, there are no operational changes to the en, de, and fr language modes, I think.

- Calamath
Thanks for your efforts!

I never noticed you posted on here too. I had originally decided I was just going to wait for Greymoor to push an update, but there's absolutely no reason not to just add the API version in there and release it now.

Updated to revision 14!
Last edited by ArtOfShred : 05/19/20 at 08:23 PM.
Report comment to moderator  
Reply With Quote
Unread 04/27/20, 03:58 AM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 36
File comments: 220
Uploads: 7
Improvements to support the backup font feature

Hi, this is Calamath.
Before making a pull request, I'll post this for improvements to support the new backup fonts feature.

>Backup Font
It is the function to specify the fallback font file in GuiXML for each font, introduced in update 25.
In other words, it is a function to search for missing glyphs not included in Western fonts from another file.

Unfortunately, the behavior of fallback fonts has changed since update 25, and the default fallback font is gone.
At least if you specify a font filename with SetFont method, the fallback font feature doesn't seem to work properly.

Therefore, some add-ons using LibMediaProvider have a problem that localized Japanese text is not displayed correctly in Japanese language mode.
This is a niche issue, but I wanted to solve it so that it would not affect users who only use Western fonts.

so, I forked recent version and made a patch on my github repository.
I would be happy if you could check it in your spare time.


[modifiation details]
I modified the font media table of LibMediaProvider and defined a font string like '$(MEDIUM_FONT)' for western font files embedded in ESO.
This is because the backup font cannot be directly linked to the font filename at this time.

In the patched version, the optional definitions of backup fonts will only be loaded in two language modes, jp and ru.
Therefore, there are no operational changes to the en, de, and fr language modes, I think.

- Calamath
Report comment to moderator  
Reply With Quote
Unread 03/03/20, 05:47 PM  
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view AddOns

Forum posts: 103
File comments: 792
Uploads: 2
Updated to revision 13. This removes the embedded LibStub and allows LMP to function without LibStub.

Loading in with LibStub is still supported if it is enabled in order to provide backwards compatibility for older addons.
Report comment to moderator  
Reply With Quote
Unread 12/30/19, 05:10 PM  
Edorenel
 
Edorenel's Avatar

Forum posts: 0
File comments: 12
Uploads: 0
I'm uncertain about the workings of add-ons and libraries. So, forgive me for my noob question. *Blushes* But will this add-on update to The Elder Scrolls Online v5.2.11 (or 5.2.5, according to some of the current, most popular add-ons)?
Report comment to moderator  
Reply With Quote
Unread 09/30/19, 03:36 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4903
File comments: 5974
Uploads: 78
But you could prepare it for this already today?
Hybrid version without and with LibStub.
You can even ship LibStub with it but it currently ONLY loads with LibStub.

Why not do it like this already today and you are automatically set for the future, and ppl who do not want to use LibStub anymore are not forced to use it?

And defintaley a NO GO (at least for other libraries): Do not load libraries hardcoded from your txt file but let them use their own txt file!
-Reason is described here-

Include LibStub in the library here BUT include the total LibStub with it's own LibStub.ttx file so it will be loaded ingame properly and all other addons can benefit from it please.

Where LibStub shouldn't be a problem if loaded like this as it will be gone one day, but even this lib could need an update before this happens , which could break the addons then as it got no own ## AddOnVersion: tag and own txt file in this library here.

TXT manifest file:
Code:
## Title: LibMediaProvider-1.0
## Author: Seerah
## Version: 1.0 r13
## APIVersion: 100028 100029
## AddOnVersion: 13
## IsLibrary: true
## OptionalDependsOn: LibStub
## Description: Facilitates shared media between addons.  Inspired by and borrowed from LibSharedMedia World of Warcraft.

# This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
# The Elder Scrolls® and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries.
# All rights reserved
#
# You can read the full terms at https://account.elderscrollsonline.com/add-on-terms

LibMediaProvider-1.0\LibMediaProvider-1.0.lua

Lua Code:
  1. --LibMediaProvider-1.0 is inspired by and borrows from LibSharedMedia-3.0 for World of Warcraft by Elkano
  2. --LibSharedMedia-3.0 and LibMediaProvider-1.0 are under the LGPL-2.1 license
  3.  
  4. --Register LMP with LibStub
  5. local MAJOR, MINOR = "LibMediaProvider-1.0", 12
  6. local LMP, oldminor
  7. if LibStub then
  8.     LMP, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
  9. else
  10.     LMP = {}
  11. end
  12. if not LMP then return end --the same or newer version of this lib is already loaded into memory
  13. LibMediaProvider = LMP

That's all you should need to make it hybrid and support all cases properly today already.
Last edited by Baertram : 10/01/19 at 10:15 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: