Open thepag opened 10 years ago
Discussing the internal vars for the player solutions:
The bit I do not like is how the solution data is written directly to the jPlayer object. The html
and flash
solutions did not clash, but a plugin called setMedia
would be bad... But I suppose you could argue it would be rather stupid to name your plugin that, but what about all the other obscure internal methods and properties. Point being, the solution data should be moved to a new object for the purpose of holding all the solution plugins.
this.player = {};
// ...
plugin: function(plugin) {
if(typeof plugin !== 'object') {
return;
}
if(plugin.type === "player") {
this.player[plugin.name] = plugin;
// do the other stuff to register a player plugin.
}
Try to follow the jshint rules in the .jshint files. We conform with all of the jQuery ones, except the double quotes rule. I try and use doubles now for new additions, but as you may notice, I forgot just now in that example for the 'object' string above.
grunt test
to jshint all the js files.
This post here on a YouTube player may be relevant #181
@thepag I did some progress and would like your input on few points. I separated jPlayer into a core and solution plugins (html, flash, aurora). The core knows nothing about plugins and even html plugin is optional. You can take a look on my branch here: https://github.com/Afterster/jPlayer/tree/plugins (at the time I wrote this, I'm talking about commit https://github.com/Afterster/jPlayer/tree/24f165323962dff6caec9d5da4e31c7b18f71262).
To make a test, just create a regular jPlayer demo with these changes:
<script type="text/javascript" src="jquery.jplayer.js"></script>
<script type="text/javascript" src="jquery.jplayer.html.js"></script>
<script type="text/javascript" src="jquery.jplayer.flash.js">
<!--<script type="text/javascript" src="jquery.jplayer.aurora.js"></script>-->
solution: {
html: {},
flash: {
swfPath: "js"
},
/*aurora: {
formats: 'flac'
}*/
},
Everything should work as in 2.9.2, including playlist, video and inspector ; but I'm facing two issues where your help would be appreciated:
Thank you for your answer. For now I will train myself on a Silverlight and Chromecast solution plugin (this one will require a new discussion later, even if it is technically a solution plugin, casting should be another user interaction from the UI) to see if the plugin architecture is flexible enough for new plugins.
I just added Chromecast solution and it's working fine enough to test it.
To test Chromecast plugin, include the following additional scripts:
<script type="text/javascript" src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
<script type="text/javascript" src="jquery.jplayer.chromecast.js"></script>
And configure jPlayer with chromecast solution:
solution: {
chromecast: {}
},
A Chromecast session is stored in LocalStorage to automatically reconnect to the session (=previous Chromecast device) in case of page refresh for instance.
Additional technical stuff would be to add format check (we cannot ask Chromecast device for format support, we have to hard-code this from https://developers.google.com/cast/docs/media) and better video support (subtitles, ...). I believe at the end the purpose is to have a "Cast" button (in default skin or not, that's not the important part). To have an efficient button we have to be able to switch from html solution to chromecast solution dynamically, when the song is playing. What do you think?
I just added Silverlight solution this evening. Again, it's not fully debugged but working enough to be tested if you want. I'm creating few plugins in attempt to open this discussion and see current limitation. My next try will be to create a Youtube plugin (#181).
This plugin add new wmv and wma filetype support (in addition to wav, mp3 and m4v fallback). I was creating a Silverlight module which only exposes Silverlight MediaElement control through javascript but then found mediaelement.js silverlight source code during one on my search. Their silverlight module is independent enough and do the exact same thing that what I was doing... This plugin then directly use silverlightmediaelement.xap file from mediaelement.js project. I don't see any value to recreate the same module or to fork it for now.
To test it:
<script type="text/javascript" src="jquery.jplayer.silverlight.js"></script>
solution: {
silverlight: {}
},
@Afterster On 5/01/2015 you mention the file "jquery.jplayer.chromecast.js" Where can I find it to work on it and improve it?
Thank you.
You can found it on my fork here: https://github.com/Afterster/jPlayer/blob/plugins/src/javascript/jplayer/jquery.jplayer.chromecast.js
But I didn't work on it anymore and I will not as it requires real discussion with project maintainers which was unfortunately not attempted in several months...
Oh, so the project is dying? That's sad as it was so good... Thank you for sharing your code. I will try to improve it and share it for others if I get it to work perfectly.
@thepag let's discuss next week in London this, I'm interested in adding/maintaining plugins support for jPlayer
During the aurora.js merge in #246 we began discussing plans for changing the internal player solutions to plugins. The HTML plugin will then be included by default and the Flash and Aurora plugins would then be optional. However, in practice I think we would default ship with both html and flash as we do now.
Discussion will continue in this thread, along with possible C&P of posts from other threads.