AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://airensoft.com/ome.html
MIT License
515 stars 126 forks source link

feature request: customizable error icon #411

Closed ysliew closed 8 months ago

ysliew commented 9 months ago

Current player display a large warning sign (triangle with exclamation mark in it) along with error messages.

Possible to provide user options to replace the icon (based on type and severity of icon)?

Or, at which .js file (and line number) to manually change the icon (by providing simple logic based on type of error)?

SangwonOh commented 8 months ago

@ysliew Hi. We can change the icon with CSS like below:

i.op-con.op-warning::before {
    background-image: url(your/image/path.png);
}

However, the player needs to be updated to set icons for each error type.

Now the .op-warning class is used for all errors. If you add different classes for each error code in the code below, you can display different icons for each type. https://github.com/AirenSoft/OvenPlayer/blob/548e18c09f8e1efb9c4d53839461b8e5be32bac7/src/js/view/components/helpers/main.js#L233

Ex) Add the error code class and change icon

i.op-con.op-warning.100::before {
    background-image: url(your/image/path.png);
}

Error codes are defined below. https://github.com/AirenSoft/OvenPlayer/blob/548e18c09f8e1efb9c4d53839461b8e5be32bac7/src/js/api/constants.js#L152

ysliew commented 8 months ago

That should work now as a quick hack, thank you very much for the info!

(By the way, perhaps in the future: it could be simpler to do so through some configuration settings)