Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide non-React JS API #16

Open
tepaze opened this issue Jul 3, 2017 · 8 comments

Comments

@tepaze
Copy link

commented Jul 3, 2017

Hi,

Do you think about building a vanilla JS MPV component ?

It would be cool :-)

@Kagami

This comment has been minimized.

Copy link
Owner

commented Jul 3, 2017

Yea, it would be nice, not everyone using React.

@tepaze

This comment has been minimized.

Copy link
Author

commented Jul 3, 2017

Like me :-)

I'm trying to build an electron video player with non h264 capabilities, to build a video app around video, and it's not easy to find another component than WebChimera.js... The problem is WCJS is not sure for the futur, and had no hw decoding capability...

Perhaps it's electron that is not the right choice...

Hope you take time to build that Vanilla JS MPV component :-)

@burketeralogics

This comment has been minimized.

Copy link

commented Jul 6, 2017

Yeah I second this one. I was able to read through the react component code and cobble something together to create an angular component. A vanilla example would have been very helpful though.

If I get a breather I'll look over my code for the component and see if I can break it down into something vanilla, it's a simple one, so a lot easier to use.

I'm using this for an Electron app (angular as the framework) and it works great so far. I needed multicast video playback as a requirement.

I spent time in WCJS hell, mpv.js is serious a blessing. It took me a day or so to get up and running, including compiling on an ancient distro. Easier to maintain, seems quicker, a bit more flexible, and works.

@CanRau

This comment has been minimized.

Copy link

commented Sep 8, 2017

would love this too :D

and as a side note, I tried to vueify it but couldn't get require.resolve to work so far because I'm using webpack and it's returning the module id instead of like node returning the actual path
any ideas about this one?

@Kagami Kagami changed the title Vanilla Component ? Provide non-React JS API Dec 30, 2018
@TRPB

This comment has been minimized.

Copy link

commented Jun 23, 2019

If anyone's interested, I spent about half an hour getting some basic functionality working without react. This may be a helpful starting point for anyone interested:

  var embed = document.createElement('embed');
  embed.type = 'application/x-mpvjs';

  document.body.insertBefore(embed, document.body.firstChild);


  embed.addEventListener('message', function(recv) {

    if (recv.data.type == 'ready') {
        var type = 'command';
       var data = ['loadfile', '/home/tom/tmp/mpv.js/example/tos.mkv'];
       const send = {type, data};
       embed.postMessage(send);
    }
  });

Take a look at index.js for the other commands, but this should be helpful for anyone else wanting a simple example.

@guest271314

This comment has been minimized.

Copy link

commented Sep 25, 2019

@TRPB Can the code be used at Chromium browser?

@TRPB

This comment has been minimized.

Copy link

commented Sep 25, 2019

If the extension will load, probably but it's rather pointless unless your site is an intranet site and you have control of all the installations.

@guest271314

This comment has been minimized.

Copy link

commented Sep 25, 2019

@TRPB What mean is using mpv.js without an "extension". As Chromium uses a video decoder (for VP8 and VP9 and potentially in the future for any codec) that does not resize HTML <video> element when underlying frame resolution changes, only displays the pixel dimensions of the initial pixel dimensions in the container metadata. Am trying to determine if this code can be adjusted to substitute for HTML <video> element altogether on the main thread in HTML document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.