简体   繁体   中英

Node webkit app crashing while loading Vimeo video

I am working on a desktop application implemented in Node webkit. I have already integrated Vimeo Video Player (using Froogaloop) in it. Till last month, it was working fine, but since then, it has been crashing almost every time.

I checked with earlier versions of my app where it was working fine earlier, but it started crashing there as well.

I tested the basic Vimeo Player code from their API. Its as follows:

JS:

$(function () {
            var iframe = $('#player1')[0];
            var player = $f(iframe);
            var status = $('.status');

            // When the player is ready, add listeners for pause, finish, and playProgress
            player.addEvent('ready', function () {
                status.text('ready');

                player.addEvent('pause', onPause);
                player.addEvent('finish', onFinish);
                player.addEvent('playProgress', onPlayProgress);
            });

            // Call the API when a button is pressed
            $('button').bind('click', function () {
                player.api($(this).text().toLowerCase());
            });

            function onPause() {
                status.text('paused');
            }

            function onFinish() {
                status.text('finished');
            }

            function onPlayProgress(data) {
                status.text(data.seconds + 's played');
            }
        });

HTML:

<script src="https://f.vimeocdn.com/js/froogaloop2.min.js"></script>
<iframe id="player1" src="https://player.vimeo.com/video/76979871?api=1&player_id=player1" width="630" height="354" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

    <div>
        <button>Play</button>
        <button>Pause</button>
        <p>Status: <span class="status">&hellip;</span></p>
    </div>

But even this is crashing when run through Node-webkit. Interestingly, above code works fine on webpage hosted through Apache (WAMP). It seems like something is changed from Vimeo front which Node webkit is unable to handle.

Can anyone please help? I have added same question on Vimeo Forum .

Thanks.

I had this issue before. Basically NW.js supports almost no codecs out of the box, this is due to licensing issues with the codecs. Vimeo (most likely) uses mp4 for video playback which is the most popular out there but also not supported.

take a look at Using MP3 & MP4 (H.264) using the video & audio tags. On the NW.js Wiki. It explains how you can take chrome's codecs DLL and give it to NW.js

Consider 2 things:

  • This will increase your project size by a megabyte or two.
  • Including those codecs in your project may or may not require you to deal with some licensing stuff.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM