meloncholy / vid-streamer

VidStreamer.js: A simple streamer for Flash and HTML5-style videos. Supports HTTP pseudostreaming and works with JW Player's bitrate switching.
http://meloncholy.com
384 stars 64 forks source link

Allowing mimeTypes to be part of config settings #10

Closed IanShoe closed 1 year ago

IanShoe commented 11 years ago

I wanted to add mimeTypes without having to directly change the main js file so I made it part of the settings.

IanShoe commented 11 years ago

I would also recommend removing the konphyg dependency in favor of the users config reader. I have a different config setup and would like to keep my convention the same. Perhaps setting up some overridable default settings directly in the index.js would be easier (especially since there aren't too many at the moment). Something like this should help a bit on portability:

var settings = { "mode": "development", "forceDownload": false, "mimeTypes: { ".swf": "application/x-shockwave-flash", ".mp4": "video/mp4", etc... } "random": false, "rootFolder": "/path/to/videos/", "rootPath": "videos/", "server": "VidStreamer.js/0.1.4" }

I can write this if you'd like and make another pull request. Let me know what you think :)

meloncholy commented 11 years ago

Thanks for this. You're right about putting the MIME types into settings (don't know why I didn't do that originally...).

I'm not sure that sticking the config directly in the file is a good idea: I separated it to reduce the need to edit the source, and, unlike a lot of modules where the defaults are pretty good, these are things that everyone needs to change.

But Konphyg should go, particularly as requiring a JSON file directly works just fine and, as you say, imposing a particular config method doesn't sit too well for modules. Having something that can be more easily and selectively overridden would be good. I'm tempted to do something like Winston; does that work for your use case?

Also I hope you can give me a day or two to sort this out. I'm very busy with work, so it may take a little while before I have time to test, merge, submit to npm, etc.

IanShoe commented 11 years ago

I'm not familiar with Winston so I can't really speak much for or against it. I guess the change I'm looking for is that I generally include only 1 sectioned config file per project (usually required in the server.js file) which I then inject in the services I have. I was thinking to do the same by injecting the file into your vid-streamer.

But yeah, no rush on the changes. I've got it in a working state. I'll keep an eye out for activity and let me know if I can help!