B
B
BonBon Slick2019-08-14 16:44:44
JavaScript
BonBon Slick, 2019-08-14 16:44:44

How to import a library or file where you need to pass parameters?

jsfiddle.net/Hussnain1/ctLmx4fz/1
https://github.com/Hussnain1/Video.js-HD-Toggle-Plugin
This is another without example
https://github.com/Futurelearn/video-js-hd-toggle- ...
don't understand how to connect it in Vue component. In both cases, there is a problem with passing data to the plugin, in addition to the deprecated code that is 10 years old.
Here is what I found
https://stackoverflow.com/questions/29923879/pass-...
https://github.com/videojs/video.js/issues/3473
https://github.com/videojs/video.js /issues/3691
And these options are also already outdated, or they require a very serious improvement, update.
Again, sculpting everything into a component is insane, it already has 350+ lines, so it will be necessary to take it out to a file and transfer data there, as I understand it.

<script>
    "use strict";

    import {mapGetters, mapActions} from 'vuex';
    import videojs from 'video.js';
     const videojs = import('video_js_hd_toggler.js').then(toggleHD => toggleHD(videojs, ''urlSD, 'urlHD')); // add button plugin
    // const videojs = (await import('video_js_hd_toggler.js'))(someoptions);
    // import toggleHD from './../../../assets/js/video_js_hd_toggler'; // params required like videojs

    export default {
        name: "public_video_player",
        props: {
            options: {
                type: Object,
            },
        },
        data() {
            return {
                player: null,
            }
        },

1 - videojs is not in the library
2 - and even if it were, it only works for 1 video, as you can see in both examples HD and SD links are static, and we have everything reactive, so during initialization it is necessary to immediately override the current videojs player and links on HD and SD. How to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BonBon Slick, 2019-08-29
@BonBonSlick

I wrote my plugin following the example https://github.com/collab-project/videojs-record/t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question