Git Product home page Git Product logo

Comments (43)

benkaiser avatar benkaiser commented on July 19, 2024

Yep, we use head.js to load the resources. See: https://github.com/ohnx/node-music-player/blob/electron/views/base/main_base.html#L46

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Best of luck testing it out with Electron. Would be pretty awesome to ship an Electron app version of node music player!

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Those all are loading /static/js/player files.

Is there anywhere where /static/lib/js is being loaded, or am I missing something?

from stretto.

ohnx avatar ohnx commented on July 19, 2024

The errors appear to be caused by missing Backbone, Marionette, and jQuery libraries.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

See line 47:

      "/static/lib/libs.min.js",

Grunt generates that file from all the bower components.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Strange, it doesn't seem to be working. I guess I'll try again.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Well, it works now.

I changed nothing.

._.

Thanks!

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Nope wait. Looking at your errors in the console I can see what's causing it.

See that first error, it's originating from the libs.min.js file.
Fixing that error will fix the issue.

Did you happen to re-run grunt? Because I'm trying to work out how it could have fixed itself...

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Well, now the page loads and looks like this:
screen shot 2015-10-08 at 9 05 31 pm

There still are errors, but it's different compared to what it was like before.

I didn't change a thing.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Okay so it isn't loading the slider library... Might also still be libs/grunt related.

On another note, how would we let users set their music library in electron? Still through the setting screen, or should we have some kind of folder selection?

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Actually, I believe I added an explicit <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> to fix the issue.

At the moment, it's the same application, just framed in an Electron window, so it's still the same setting screen.

I'm not sure if Electron implements a folder select screen. If it does, then I can try to use it.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

I just re-ran grunt, it said no errors:

Running "bower:install" (bower) task
>> Installed bower packages
>> Copied packages to /Users/mason/Desktop/node-music-player/static/lib

Running "copy:fontawesome_fonts" (copy) task
Copied 6 files

Running "copy:fontawesome_css" (copy) task
Copied 1 file

Running "uglify:my_target" (uglify) task
>> 1 file created.

Running "cssmin:target" (cssmin) task
>> Ignoring remote @import of "//fonts.googleapis.com/css?family=Raleway:400" as no callback given.
>> 1 file created. 142.06 kB → 128.52 kB

Done, without errors.

The slider issue is still there.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Okay... so we'll have to fix that hack, but sure works for testing it out.

Yeah all good, I'm just getting a few ideas of how to do things differently for an Electron application.

Does:
static/lib/seiyria-bootstrap-slider/bootstrap-slider.js
that file exist for you? because that's the slider lib it should be pulling into the libs.min.js

from stretto.

ohnx avatar ohnx commented on July 19, 2024

It exists for me.

The problematic code seems to be around line 407 in player.js:

  this.setScubElem = function(elem){
    this.scrub = elem;
    this.scrub.slider()
      /* disable seeking as soon as slide / click starts.
      * this was added due to an issue causing the slider to update to the old
      * duration even when a click was triggered because of the delay for the
      * slideStop
      */
      .on('slideStart', function(){ player.isSeeking = true; })
      .on('slide', function(slideEvt){ player.scrub_value = slideEvt.value; player.scrubTimeout(); })
      .on('slideStop', function(slideEvt){ player.scrub_value = slideEvt.value; player.scrubTimeoutComplete(); });
  };

elem appears to not have any attributes

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

but the error says: this.scrub.slider() is not a function. That means it's failing to load the slider library (because that .slider() function comes from there).

As a result anything using the slider won't work.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Ah, okay. Do you want me to try to explicitly load static/lib/seiyria-bootstrap-slider/bootstrap-slider.js as well and see if that helps?

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Yeah maybe.
If that fixes it then something in libs just isn't loading / being generated correctly.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Well, I just tried it.

Still doesn't work.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

I think it could be calling that code before the slider library actually loads. And so it'll still fail because the slider library hasn't been loaded before it is used.

Check the network tab to see what order files are coming in. And maybe try re-execute the code with something along the lines of: player.scrub.slider() and see if it works after everything is loaded.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

I checked the network tab, the explicitly loaded slider plugin is coming way before any other scripts.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

If it helps, this isn't working when I just normally run it and go to localhost:2000 in my browser.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Weird, Safari works...

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Huh. That is weird.

What is the other browser you were trying? Chrome?

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Yep.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Funnily enough, http://music.kaiserapps.com/ works just fine in Chrome, it's just my local version that has issues.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Maybe nuke all the libs and stuff that bower installs and re-run grunt?

On Fri, 9 Oct 2015 12:33 pm Mason X [email protected] wrote:

Funnily enough, http://music.kaiserapps.com/ works just fine in Chrome,
it's just my local version that has issues.


Reply to this email directly or view it on GitHub
#63 (comment)
.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Maybe nuke all the libs and stuff that bower installs and re-run grunt?

Err, how would I do that?

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Look in the gitignore, and remove any of the files that match those rules.
Think that should do it.

On Fri, 9 Oct 2015 12:43 pm Mason X [email protected] wrote:

Maybe nuke all the libs and stuff that bower installs and re-run grunt?

Err, how would I do that?


Reply to this email directly or view it on GitHub
#63 (comment)
.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Gosh darn, nope.

I removed everything (node_modules, static/lib, bower_components), and then reinstalled it.

Still the same error.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Since this only happens with the latest versions, I may try to download a zipped version of node music player that I know works (the one that runs on my server).

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Yeah, not a bad idea.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

So, I just tried it.

I downloaded the zip of everything from my server (that I know for sure works) and extracted it in a folder.

The error is still there.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

This might actually be an issue with bootstrap-slider itself. I will try and investigate.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

@ohnx did you end up getting anywhere with this?

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Not at the moment, no.

I think I might have some more time in the next week or so to work on it.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

All good @ohnx, no rush.

On Wed, 4 Nov 2015 at 14:11 Mason X [email protected] wrote:

Not at the moment, no.

I think I might have some more time in the next week or so to work on it.


Reply to this email directly or view it on GitHub
#63 (comment)
.

from stretto.

steveostudios avatar steveostudios commented on July 19, 2024

Just stumble across this thread... You might have a look at this thread. Apparently Electron (specifically) doesn't like slider
http://stackoverflow.com/questions/32414344/how-do-i-use-bootstrap-slider-in-electron

from stretto.

ohnx avatar ohnx commented on July 19, 2024

@steveostudios Ah, thanks for that link.

This makes a lot more sense.

I'll take a look at this and try to use the workaround suggested.

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Yeah. Also I think if its specifically bootstrap-slider related, you should place an issue on their repo. I did a quick search and they had no issues logged for electron.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

I'll add one later.

In the meantime, I'll try the workaround mentioned by @steveostudios.

from stretto.

ohnx avatar ohnx commented on July 19, 2024

Oh, I need to modify the minified code.

I think I need to try something else...

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Hey @ohnx , I'm working off your changes now and building an electron build. No promises tho ;)

For future reference to people looking for how to solve the jquery and bootstrap slider issues, turns out because in Electron the module global variable is set in the browser, it messes up jquery (and hence slider, because it uses jquery). The solution for me, because I didn't care about node-integration in the browser was to add 'node-integration' = false in my BrowserWindow options like so:

mainWindow = new BrowserWindow({width: 800, height: 600, 'node-integration': false});

Alternatively you'll have to require jquery (and the slider... not 100% sure how to do that) into the browser window directly, see: electron/electron#254

from stretto.

benkaiser avatar benkaiser commented on July 19, 2024

Closing as electron binaries have now been shipped.

from stretto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.