AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://OvenMediaEngine.com/ovenplayer
MIT License
498 stars 124 forks source link

Possible to change label and/or watermark with load() #258

Open sephentos opened 2 years ago

sephentos commented 2 years ago

I have multiple different mp4 files which I like to serve.

A JS event triggers the change with...

... (within a click event listener) ..
...
            player.stop();
            player.load([{
                waterMark: {
                    text: 'new watermark text',
                    image: "/assets/img/watermark.png",
                    y: "20px",
                    x: "20px",
                    width: "80px",
                    height: "15px",
                    position: "top-left",
                    opacity: 0.7
                },
                label: 'new label',
                type: 'mp4',
                file: <mp4 file>
            }]);
            player.play();
...

This currently "only" works for changing the media file, but the label and watermark text remains unchanged. Is there a possibility to also change these values ​​with load()?

global OvenPlayer create:

let player = OvenPlayer.create('player', {
    autoStart: true,
    controls: true,
    image: "/assets/img/poster.jpg",
    waterMark: {
        text: 'first file to be shown when entering the site',
        image: "/assets/img/watermark.png",
        y: "20px",
        x: "20px",
        width: "80px",
        height: "15px",
        position: "top-left",
        opacity: 0.7
    },
    label: 'first file to be shown when entering the site',
    type: 'mp4',
    file: <first file to be shown when entering the site>
});
SangwonOh commented 2 years ago

@sephentos Hi. As you said load() works for only the media file. We are now dealing with that by removing (remove()) the player and re-creating(OvenPlayer.create()) it. It would be nice if setImage() and setWatermark() APIs were added. However, the implementation is likely to take some time due to the low priority. Thanks!

sephentos commented 2 years ago

@sephentos Hi. As you said load() works for only the media file. We are now dealing with that by removing (remove()) the player and re-creating(OvenPlayer.create()) it. It would be nice if setImage() and setWatermark() APIs were added. However, the implementation is likely to take some time due to the low priority. Thanks!

Thanks for the reply!

Alright, I understand.

Hope to see such an option in the future. It would be even nicer if the same parameters as with OvenPlayer.create() could be used in load() so that the player would automatically rebuild itself with the new parameters.