Plugin

Developer
Supported

MC Player

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Michael Cohen

1 of 2
1
   

You must be logged in to post.

Audio playlist is empty

Bug Report

artmem
artmem

I’m using the plugin to play individual audio files with no problems, but when I try to use a playlist for audio files, I just get an empty player.

Here’s the code I’m using:

{exp:mc_player:play playerpath="assets/scripts/mediaplayer/player.swf" width="320" height="30"}
    {exp
:mc_player:playlist position="bottom" size="240"}
  {exp
:channel:entries channel="songs" orderby="title" sort="asc" disable="categories|category_fields|member_data|pagination" dynamic="no"}
    {if audio_file}
      {exp
:mc_player:item file="/{audio_file}"}
    {
/if}
  {
/exp:channel:entries}
    {
/exp:mc_player:playlist}
{
/exp:mc_player:play} 

It seems to be rendering right though:

<video id="player___10_Back_in_the_USSR-mp3_02_Locomotive_Breath-mp3_03_clip-one-way-out-mp3_07_Teacher_Cross_Eyed_Mary-mp3_09_Thing_Called_Love-mp3_15_Whippin_Post-mp3" class="media_player" width="320" height="270" controls="controls">
</
video>
[removed]
jwplayer
('player___10_Back_in_the_USSR-mp3_02_Locomotive_Breath-mp3_03_clip-one-way-out-mp3_07_Teacher_Cross_Eyed_Mary-mp3_09_Thing_Called_Love-mp3_15_Whippin_Post-mp3').setup({
 flashplayer
'assets/scripts/mediaplayer/player.swf',
 
playlist[
  {
   file
"/"
  
},
  
{
   file
"/assets/uploads/audio/10_Back_in_the_USSR.mp3"
  
},
  
{
   file
"/assets/uploads/audio/02_Locomotive_Breath.mp3"
  
},
  
{
   file
"/assets/uploads/audio/03_clip-one-way-out.mp3"
  
},
  
{
   file
"/assets/uploads/audio/07_Teacher_Cross_Eyed_Mary.mp3"
  
},
  
{
   file
"/assets/uploads/audio/09_Thing_Called_Love.mp3"
  
},
  
{
   file
"/assets/uploads/audio/15_Whippin_Post.mp3"
  
}
 ]
,
 
wmode'opaque',
 
width'320',
 
height'270',
 
volume'80',
 
'controlbar.position''over',
 
'playlist.position''bottom',
 
'playlist.size''240'
});
[removed] 

If I add container_tag=“audio” to my initial tag, I get this php error:

Message: Undefined index: file
Filename: mc_player/pi.mc_player.php
Line Number: 412

Michael C.
# 1
Developer
Michael C.

Hi Artmem,

Could you link to a screenshot of what you call an “empty player”? When I replicated your code, I got a working player, although it did have some quirks:

Quirk 1: Because it was playing in “video” mode (the default; as opposed to container_tag=“audio”, which you specified later), the controlbar defaults to “over”, which means that only the bottom half of it shows in a 30px high player. :)
Quirk 2: You didn’t provide any title, description, or image for the playlist items, so the playlist buttons are rendered blank.

Please let me know if either of those quirks are what you were referring to by an “empty player”.

In the meantime, I’m working on fixing that PHP error you encountered when adding the container_tag=“audio” parameter.

Michael C.
# 2
Developer
Michael C.

FYI, I’ve posted v0.2.4, which should fix the PHP notice (it’s not an error, despite how it looks) you were getting.

artmem
# 3
artmem

I updated to the latest version, and I’m not getting the php notice.

I added the ‘container_tag=“audio”’ and it didn’t make any difference. I also tried changing the height from 30 to 300, and, again, no difference.


I’ve attached screen shots from both Firefox and Safari. In safari, the control is just a play button and nothing else. In Firefox, there is also a scrub bar and volume control, but they don’t do anything.

Michael C.
# 4
Developer
Michael C.

That’s how it looks in Firefox/Safari? O.o We’re definitely not seeing the same thing.

Could you let me know what OS are you running, do you have Adobe Flash installed, and what version of the JW Player you’re using?

artmem
# 5
artmem

I’m running Mac OS 10.7.3. Flash is installed. I’m using a flash blocker in Safari, but it is enabled for the page. There is no blocker in safari. I’m using JW Player version 5.8.2011. I also checked it in Chrome, and it looks basically the same as the Firefox screenshot.

Michael C.
# 6
Developer
Michael C.

Ok, here’s what I think is happening. Both of those screenshots indicate to me that what you’re seeing is the built-in HTML5 <video> player controls, not the Flash player. So first off, could it be that the Flash player is failing to load because you’re pointing to “assets/...”, as opposed to the “/assets/...” directory I see at the start of the MP3 URLs?

Secondly, even when Flash is absent, the browsers should fall back on the built-in HTML5 players, which they appear to be doing. However, the only playlist format that the HTML5 <video> player supports natively is the mediaRSS format:

Playlist Support in the JW Player - Loading external RSS playlists
Note that JW Player supports additional playlist formats in Flash-only mode. For HTML5, the player only supports mediaRSS (as of version 5.7). Since mediaRSS is the industry standard for media playlists too, we strongly recommend you use this format.

So your best solution is probably to use the {exp:channel:entries} tag to generate a mediaRSS-formatted XML. That should ensure it works for both in the Flash mode as well as the HTML5 fallback.

Let me know how you fare. :)

artmem
# 7
artmem

Adding the extra slash before assets in my path didn’t seem to do anything.

I created a XML playlist, but I just get a php error and no player at all now. Here’s the code I’m using:

{exp:mc_player:play playerpath="assets/scripts/mediaplayer/player.swf" width="480" height="270"}
    {exp
:mc_player:playlist file="band/playlist.xml"}" position="right" size="360"}
{/exp:mc_player:play} 

I’ve tried changing the playlist path to a full url, a ee path tag, and just playlist.xml, and nothing seems to work.

 

artmem
# 8
artmem

This is the php notice I’m getting:

Message: Undefined index: file
Filename: mc_player/pi.mc_player.php
Line Number: 523

Michael C.
# 9
Developer
Michael C.

You’ve got an extra “} in your playlist file parameter.

Could you post or PM me the URL you’re trying to get to work?

artmem
# 10
artmem

I took out the extra } and it didn’t change anything. It’s still not loading anything, and the debug info says: “No file, playlist, or levels specified; aborting”, no matter how I set the path to the playlist template.

The site is http://test.bakerbruceband.com the player should be loading at the bottom of the homepage (but right now, it isn’t loading at all). The plugin is working with individual songs on this page: http://test.bakerbruceband.com/band/songs

I couldn’t find a way to PM you through devot-ee, but if you post your email, I’ll send you login credentials, if you want.

Michael C.
# 11
Developer
Michael C.

Sure, send it to contact@pro-image.co.il.

Michael C.
# 12
Developer
Michael C.

Ok, I’m pretty sure I discovered the problem. By default, the plugin implemented an <video> container tag, which doesn’t support playlists. Further research revealed that using <video> as the container_tag was not accomplishing what I had thought it was accomplishing, so I switched things around so that a <div> tag will be used by default instead.

I’ve updated the plugin to 0.2.5; let me know if that resolves your problems. :)

artmem
# 13
artmem

Thanks. I updated, and now I’m not getting the php notice, but I’m getting an error that javascript must be enabled. The Safari debug tool error is: 162ReferenceError: Can’t find variable: jwplayer

My code is still the same:

{exp:mc_player:play playerpath="assets/scripts/mediaplayer/player.swf" width="480" height="270" }
    {exp
:mc_player:playlist file="band/playlist.xml" position="right" size="360"}
{
/exp:mc_player:play} 
Michael C.
# 14
Developer
Michael C.

I’m pretty sure that’s because the jwplayer.js script needs to be in the header (or at least before the player itself). I tried to make the appropriate changes to your test site to verify, but the templates aren’t successfully being written to disk when I save them.

I’m debating whether to include parameters to determine whether to make use of jQuery to delay the player script running until the jwplayer.js has loaded, thus allowing the script to be placed at the bottom of the page but requiring jQuery, or including my own internal onload-style thing. Would something like that be of use? Perhaps along these lines:

{exp:mc_player:play ... load_method="regular|int_delay|jquery_delay" ... 

In the above example, “regular” would require the jwplayer.js script to be in the <head> tag (or at least to come before the player itself), “int_delay” would allow the jwplayer.js script to be placed at the bottom of the page, above </body>, while “jquery_delay” would accomplish the same, just making use of (and obviously requiring) jQuery’s document ready delay.

artmem
# 15
artmem

Moving the script to the head loads the player, but it can’t find the playlist. Should I be specifying the playlist file path differently?

I think allowing the script to be moved to the bottom would be a good feature. I don’t think requiring jquery would be a big deal, especially if it is optional. I use jquery on almost all of my sites anyway, and the convenience of keeping all of my scripts together would be nice.

1 of 2
1