Download
(21 Kb)
Download
Updated: 04/16/24 11:55 PM
Compatibility:
Scions of Ithelia (9.3.0)
Updated:04/16/24 11:55 PM
Created:03/13/14 10:38 PM
Monthly downloads:80,155
Total downloads:2,687,008
Favorites:994
MD5:
Categories:Libraries, Game Controller
9.3.0
LibMediaProvider  Updated this week!  Popular! (More than 5000 hits)
Version: 1.0 r29
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.slug|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 r29 (Calamath)
- Migration to the new UI font rendering system with Slug fonts.
- Restored the file structure and removed backward compatibility to Update 40.
- Adjusted predefined font definitions for the unofficial language mod add-ons, EsoBR, Cervanteso, EsoKR and EsoPL.
- Updated API version to 101041 (ESO 9.3.x : Update 41)

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 (28)
File Name
Version
Size
Uploader
Date
1.0 r28 - beta
39kB
Calamath
01/29/24 01:29 PM
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 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: 224
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: 4973
File comments: 6038
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
Unread 09/23/19, 04:32 PM  
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view AddOns

Forum posts: 103
File comments: 792
Uploads: 2
Re: Re: Re: Directory structure is screwy

Originally Posted by Baertram
Why is this lib not working properly without LibStub?
There should be a way to make it compatible with and without LibStub, isn't it?
We were waiting for sirinsidiator to remove LibStub support from LAM before making this move. Once LAM makes that move a lot of old addons will break and it will be the ideal time to force everyone to update everything. That's why the embedded LibStub is still used.
Last edited by ArtOfShred : 09/23/19 at 04:41 PM.
Report comment to moderator  
Reply With Quote
Unread 09/22/19, 06:56 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4973
File comments: 6038
Uploads: 78
Re: Re: Directory structure is screwy

Why is this lib not working properly without LibStub?
There should be a way to make it compatible with and without LibStub, isn't it?
Report comment to moderator  
Reply With Quote
Unread 05/20/19, 01:26 AM  
psypanda
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 11
Uploads: 0
Re: Directory structure is screwy

Originally Posted by AssemblerManiac
Main folder in the zip is listed as being LibMediaProvider-1.0r10, which is empty of files, with LibMediaProvider-1.0 as a directory under it.

Was this intentional?
Ah damn seems like I nested the folders by accident while creating the zip.
I'll fix this asap. Sorry for the inconvenience.
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 11:09 PM  
AssemblerManiac
AddOn Author - Click to view AddOns

Forum posts: 51
File comments: 314
Uploads: 1
Directory structure is screwy

Main folder in the zip is listed as being LibMediaProvider-1.0r10, which is empty of files, with LibMediaProvider-1.0 as a directory under it.

Was this intentional?
Report comment to moderator  
Reply With Quote
Unread 02/06/17, 02:48 PM  
Imiona
 
Imiona's Avatar

Forum posts: 16
File comments: 64
Uploads: 0
Is it possible to register my own custom Fonts with this, and if so, how do i get Addons to use it?

Thx
Report comment to moderator  
Reply With Quote
Unread 02/23/15, 08:54 PM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 832
File comments: 1097
Uploads: 33
LibMediaProvider-1.0 r8

Even if patch 1.6 is not on live server yet, I have updated this library in advance. Actually there was just one small change - all Futura fonts were replaced with different font files which includes previously unsupported special characters (for example ñ). As those new font files doesn't exist in 1.5 game files, I do not recommend using r8 with patch 1.5.
Report comment to moderator  
Reply With Quote
Unread 08/23/14, 10:11 PM  
skyraker
AddOn Author - Click to view AddOns

Forum posts: 154
File comments: 129
Uploads: 4
Originally Posted by Garkin
Only reason I can imagine is that you use old version of LMP and register font before library is updated. There was an issue where all registered media files were removed when library was updated.
To avoid this issue update LMP to the latest version and/or make sure that you do not register media types before library is fully updated. It means from EVENT_ADD_ON_LOADED handler or later.
Can't believe I hadn't updated it. Thanks!
Report comment to moderator  
Reply With Quote
Unread 08/17/14, 09:27 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 832
File comments: 1097
Uploads: 33
Originally Posted by skyraker
Would there be any reason why LMP (or the game) would stop displaying a monospaced font properly? When I first added the font to my addon, it was displaying properly monospaced. But I do not know if a game update changed that or if it something with how LMP interacts with the UI.
Only reason I can imagine is that you use old version of LMP and register font before library is updated. There was an issue where all registered media files were removed when library was updated.
To avoid this issue update LMP to the latest version and/or make sure that you do not register media types before library is fully updated. It means from EVENT_ADD_ON_LOADED handler or later.
Report comment to moderator  
Reply With Quote
Unread 08/17/14, 08:33 AM  
skyraker
AddOn Author - Click to view AddOns

Forum posts: 154
File comments: 129
Uploads: 4
Would there be any reason why LMP (or the game) would stop displaying a monospaced font properly? When I first added the font to my addon, it was displaying properly monospaced. But I do not know if a game update changed that or if it something with how LMP interacts with the UI.
Report comment to moderator  
Reply With Quote
Unread 06/03/14, 11:48 AM  
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 249
Uploads: 3
Originally Posted by Seerah
Okay, so LibMediaProvider is just a library that uses LibStub. It is quite possible that the copy of the library you are editing is not even the copy of the library being loaded into memory.

You shouldn't edit the library itself. You need to use the API to register a font. That, or use LMP MediaStash.

/edit: Sorry I didn't get that right away...
OK I get it now, thank you for your time
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: