Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to setup jplayer in views, I set it up as a block and on page and I get:
Notice: Undefined index: extension in jplayer_sort_files() (line 119 of PATHTO/modules/jplayer/includes/jplayer.theme.inc).
Notice: Undefined index: type in jplayer_sort_files() (line 164 of PATHTO/modules/jplayer/includes/jplayer.theme.inc).
Notice: Undefined index: type in jplayer_sort_files() (line 170 of PATHTO/modules/jplayer/includes/jplayer.theme.inc).
Comment | File | Size | Author |
---|---|---|---|
#40 | jplayer-undefinedtype-1111510-40.patch | 941 bytes | kraigory |
#25 | playlist-from-fields-on-multiple-entities-1111510-25.patch | 2.65 KB | drew reece |
Comments
Comment #1
dreadlocks1221 CreditAttribution: dreadlocks1221 commentedI managed to get the above error fixed by setting the field style to jplayer and the format to unformatted list, however the player doesnt work in opera 11.01
Comment #2
vinsabus CreditAttribution: vinsabus commentedNot sure if this is the same error. I have a content type where I have assigned a file field to use jplayer. There is no problem on nodes where there is data in the field, but if the field is blank then I get this notice:
At line 150 of includes/jplayer.theme.inc, Adding the following made the error disappear.
Comment #3
prakash.yerneni CreditAttribution: prakash.yerneni commentedComment #4
prakash.yerneni CreditAttribution: prakash.yerneni commentedNotice: Undefined index: type in jplayer_sort_files()
Comment #5
prakash.yerneni CreditAttribution: prakash.yerneni commentedComment #6
prakash.yerneni CreditAttribution: prakash.yerneni commentedComment #7
yugongtian CreditAttribution: yugongtian commented+1 same error
Notice: Undefined index: type in jplayer_sort_files() (line 164 of E:\wamp\www\test17\sites\all\modules\jplayer\includes\jplayer.theme.inc).
Notice: Undefined index: type in jplayer_sort_files() (line 170 of E:\wamp\www\test17\sites\all\modules\jplayer\includes\jplayer.theme.inc).
Comment #8
yugongtian CreditAttribution: yugongtian commentedFind the error .
The field have png or jpg type image file.
can't know type 164 line "audio" or 170 "video" file type index.
How to fix it? I try it like this
Edit the views Filter criteria ,add file - name - contains -{ (file) file: name (contains mp3)}
It works.
But it can only show *mp3 name file ,
I do not know how to add other m4a (AAC), m4v (H.264), ogv*, oga*, wav*, webm* type
work together .....
So any idea ?
Thanks.
Sorry for my English.
Comment #9
dreadlocks1221 CreditAttribution: dreadlocks1221 commentedthis seems like a separate issue, please don't hijack the thread
Comment #10
dr. gubó CreditAttribution: dr. gubó commentedGot the same error, added
$player_type = '';
just before line 180 in modules/includes/jplayer.theme.inc made the error disappear.Comment #11
dr. gubó CreditAttribution: dr. gubó commentedSorry, I just discovered the "fix" I mentioned breaks the player display.
Comment #12
batje CreditAttribution: batje commentedThe solution from comment #2 worked for me.
Comment #13
ajm8372 CreditAttribution: ajm8372 commentedSolution from comment #2 seems to work for me as well.
Comment #14
rengomez CreditAttribution: rengomez commentedHi - if you follow comment #2 then where do you add $player_type = '';. Is it before or after:
$num = 0;
foreach ($media as $file) {
if ($videos == TRUE && $type != 'playlist') {
if ($file['type'] == 'audio') {
unset($file);
}
$player_type = 'video';
}
else if ($videos == TRUE && $type == 'playlist') {
$player_type = 'video';
}
else {
$player_type = 'audio';
}
Also, solution / comment #1 worked fine for me.
Thanks
Comment #15
VM CreditAttribution: VM commented#14 according to #2 you add it "At line 150"
Comment #16
deviantintegral CreditAttribution: deviantintegral commentedThis issue needs a patch.
Comment #17
brycesenz CreditAttribution: brycesenz commentedThe patch is #2 is appropriate, but does not address the issue in all cases (at least, it didn't resolve the issue for me). I've come across two common uses for jPlayer + Views:
Use Case 1) Create a view of content nodes (each of which has an mp3 as a filefield), with the intention of turning each node's filefield into a jPlayer instance.
In this case, if a node does not have content attached, you may see the errors described here, and the fix in #2 resolves the issue. For this to work, I think you also need the field's display to be set as 'jPlayer' but the views display set as 'Unformatted Content'. In this use case, the views items go through the function "template_preprocess_jplayer()", and everything then works well when that function calls "jplayer_sort_files()"
Use Case 2) Create a view of content nodes (each of which has an mp3 as a filefield), with the intention of creating one jPlayer instance to play all of the files as a playlist.
In this case, due to a difference in the fields of the $raw_files variable compared to case #1, errors abound. The fields that you've select are passed to "jplayer_sort_files()" through the function "template_preprocess_jplayer_view_playlist()", and the arrays passed are in an unexpected format.
I'm not 100% sure that use case 2 was ever intended to be supported by this module, but it seems like a feature many would want. I'm trying to figure out how to fix the module to support this, and I'll post back when I have a patch.
Comment #18
brycesenz CreditAttribution: brycesenz commentedOk, I fixed the issue for my second use case, but it required changing some code whose initial setup I don't quite understand.
Original Code (jplayer_style_plugin.inc, line 104):
Code With My Edits
With this change, the $items array stores content fields in a format that the jPlayer views style plugin can read as a playlist. But I still don't know if the original $items array format (with 'url' and 'label') existed for another use case. If that is true, my changes would break one use for the sake of another.
Can one of the committers comment on this? I need more context in order to provide a patch which I know won't break existing functionality.
Comment #19
deviantintegral CreditAttribution: deviantintegral commentedjplayer_sort_files() looks to be expecting a few keys in $raw_files, including 'uri', and 'description'. So, I'm a little surprised your changes are working for you.
Part of the confusion is that jplayer_sort_files() isn't really documented well. It'd also be useful to have an exported feature that contains a few views for testing.
Comment #20
brycesenz CreditAttribution: brycesenz commented@deviantintegral -
The problem is the jplayer_sort_files is expecting those keys in $raw_files, but they aren't there when using jPlayer as a views format (trying to display an entire view as a single jPlayer). That's why my code fixes, though I'm not sure at what expense.
For debugging purposes and to recreate the issue, do the following:
- Install and enable the Devel module, so we can print arrays easily
- Create 2-3 demo nodes with a filefield set to display as a jPlayer instance
- Create a demo view (view_1) that displays the above nodes as an unformatted list with each node's filefield displayed as a jPlayer
- Create a demo view (view_2) that displays each node's filefield as a Generic file, but uses the views format jPlayer.
- On line 108 of jplayer.theme.inc (before the loop in jplayer_sort_files()), add the line
dpm($raw_files);
In the first two cases, the node view and view_1, the $raw_files array contains all of the information we need from the file - fid, uri, filename, description, etc. In these cases, jplayer_sort_files() is being called from 'template_preprocess_jplayer()', which I believe runs before a single field instance is viewd as a jPlayer.
In the last case, view_2, the preprocess function is 'template_preprocess_jplayer_view_playlist()'. This function calls jplayer_sort_files() as well, but when it does, the rendered array only contains two fields - url and label, so we get a bunch of errors.
In jplayer_style_plugin.inc, you created the render() function that only returns these two fields ('url' and 'label'), but I don't know why. My code above changes the return values to create the array that jplayer_sort_files() is looking for, but I don't know what else it might break. My question is - why did you want render() to only return those fields?
I haven't run into problems with my altered code, but since I don't know the logic behind your render() function, I don't know what problems I might have created.
Comment #21
vladimir_e CreditAttribution: vladimir_e commentedRan into this when trying to make a single player instance playlist out of node fields.
Change in #18 fixes the issue for me.
Comment #22
flypp CreditAttribution: flypp commented@brycesenz, thanks for your code.Works perfectly but i was getting a lot of "Undefinet offset" and "Undefined index" messages.
I'm using jplayer-7.x-2.x-f8e7f32 (snapshot), and I added a little modifications:
jplayer.theme.inc
jplayer_style_plugin.inc
Comment #23
b.one CreditAttribution: b.one commentedthanks brycesenz for your patch @ #18, it works perfectly on Chrome and Internet Explorer, but not on Firefox...
anyone knows how to fix this issue ?
Comment #24
dreadlocks1221 CreditAttribution: dreadlocks1221 commentedif it doesn't work in firefox, path to swf isnt set properly
Comment #25
drew reece CreditAttribution: drew reece commentedI'm seeing this issue with a view showing multiple items with a file field, the goal is to show one jPlayer using multiple fields.
#18 didn't work - I got repeated undefined index errors as mentioned by flypp in #22
#22 worked but the audio fields without descriptions threw errors because of undefined labels.
I tweaked flypp's logic to set the description to the filename & now it works for my view.
This patch is for the 7.x-2.x it is flypp's code with the description fix.
Comment #26
brycesenz CreditAttribution: brycesenz commented@drew reece -
100 points for providing a patch, but the real issue here is that a bunch of us are trying to use the module in slightly different ways and each use case requires its own patches so far.
My patch in #18 for example solved my problem perfectly. The patch in #22 actually broke functionality for me, but it seems to have fixed the problem for others. I'm sure still many are using the module fine without any patch at all, due to other implementations.
My worry is that without direction from the module owner, we'll all keep submitting patches that work for us but break the module for others.
Comment #27
drew reece CreditAttribution: drew reece commented@brycesenz,
Cheers, I agree with you I was just happy to find a fix & #22 seems to be the one for my use case. I couldn't get #18 working since the latest code is different to the example replacement part.
I also find that Firefox (3.3 Mac) doesn't work with the multi-field views based player, I get the html themed player with no request errors. The play button doesn't start the tracks & the file link connects to the track to get the built in media player on a new page.
I think there is a fair way to go with this module, hopefully the someone is following along.
What are the alternatives for playlists in D7?
Comment #28
brycesenz CreditAttribution: brycesenz commented@drew reece -
As of right now, the best I've found for playlists is MediaFront (http://drupal.org/project/mediafront) in conjunction with the media module. There's also a different front end player that looks really nice called JWPlayer (http://drupal.org/project/jw_player), but it doesn't have great playlist functionality at this point.
Comment #29
drew reece CreditAttribution: drew reece commentedCheers,
That is the conclusion I was coming to. MediaFront didn't work for me a few months ago, but now it seems fine. I'll go with it until this gets resolved.
Comment #30
brycesenz CreditAttribution: brycesenz commentedSorry, just looking over the code in #22 - does this block of code seem wrong to anyone else?
Why would we check and array called '$video_extensions' and then set the type to 'audio' and vice versa?
Comment #31
drzraf CreditAttribution: drzraf commentedbrycesenz : #1405680: the (optional) media type detection is broken
Comment #32
gardy CreditAttribution: gardy commentedThis code works for me, but it handels only one file per node. Here is the solution for this problem.
Use this:
Instead of this:
Comment #33
nordex CreditAttribution: nordex commentedFor me this error accured when i tried to upload a file type that was not recognised by the jplayer module.
in the fieldtype i had added mp4, flv but the jplayer script under the jplayer_sort_files() function of modules/jplayer/includes/jplayer.theme.inc this is what i found in the file.
$video_extensions = array('m4v', 'mp4', 'ogv', 'webmv');
Thus it errored on me becaus it did not know of flv files. So i added flv to that list on that so it looks like this.
$video_extensions = array('m4v', 'mp4', 'ogv', 'webmv', 'flv');
After that i got the player working with a playlist of videos i had uploaded.
I hope this helps someone.
Comment #34
BDaggerhart CreditAttribution: BDaggerhart commentedI'm getting the same error:
The files work perfectly fine when I create the node for the audio files, but when I try to create the jplayer playlist view, I get the errors above. I've read through the entire thread here and tried several of the patches, but nothing seems to work. Is there any sort of fix for this yet?
Comment #35
BDaggerhart CreditAttribution: BDaggerhart commentedIs anything happening with this, or should we be looking for other options for playlists?
Comment #36
Jonathan Lauer CreditAttribution: Jonathan Lauer commentedI'm getting the same error too !
Notice : Undefined index: type dans jplayer_sort_files() (ligne 170 dans /mysitename/sites/all/modules/jplayer/includes/jplayer.theme.inc).
For the same version of jplayer module (7.x-2.0-beta1) on 2 differing sites, only one of them works fine ! It's ok on my experimental site, but on the real site it doesn't work !!! why ?
No help from maintainer since march ?
Anyone have a solution? new Ishmayl ?
Comment #37
phrequency CreditAttribution: phrequency commentedI was getting the same error with this set up:
Content Type with CCK File Field.
Created node of this type with MP3 in the file field.
WHAT WAS WRONG:
Created a BLOCK view with:
Format: JPlayer | Show: Fields
Fields: Audio Field (The name of my field, yours will be the cck field you created)
Filters: My content type (yours will be different), NID: The id of this one node which I needed for my set up and of course Published: Yes
Saved all this, added the block to my page and got the above referenced error from OP.
THE FIX:
When creating my view, I assumed I wanted Format: JPlayer but in reality you just need to set Format to Unformatted or Formatted Lists.
Then in the fields, add your audio field but this time choose JPLayer as the format for the field itself.
This outputs a nice little jplayer with no errors.
I am not sure if this addresses the other issues being discussed here but after I did this, it made more sense that this was the correct set up.
Comment #38
tuananh3988 CreditAttribution: tuananh3988 commentedi same error, i use extension MP3.
i change extension to mp3 and use version 7.x-2.x-dev. it work for me
Comment #39
chunty CreditAttribution: chunty commentedI got the same error when trying to use amazon s3 storage with signed URL's because line 144
gives something like "mp3?AWSAccessKeyId=AKIAJVCQPWR7GUONIMXQ&Expires=1387294109&Signature=FDCq4WGF07cLLQ6PJZPVNrUafbQ%3D" as the extension of the file type
Comment #40
kraigory CreditAttribution: kraigory commentedI also have this error and it is caused by using the all-caps extension MP3. Rather than trying to enforce lowercase "mp3" usage, I created a patch that will allow both. Note, the patch is off the 7.x-2.x branch. It simply performs a strtolower on the extension before trying to assign a "file type".
Comment #41
stefan_seefeld CreditAttribution: stefan_seefeld commentedWhat is the status of this issue ? The last release of the jplayer module is still 7.x-2.0-beta1 from 2012-05-25. Does this incorporate any of the above patches ?
I do observe the "Undefined index..." error trying use-case 2 above, i.e. a playlist of audio files displayed through a single jplayer instance, and would *really* like to get this working, even if I have to apply a few patches manually.
Many thanks for any help,
Stefan
Comment #42
VM CreditAttribution: VM commentedNone of the patches above have been rolled into any release.
Comment #44
markie CreditAttribution: markie commentedAll
Thanks for your patience on this. I have committed this patch (with a minor change) into the dev branch. Will be creating a beta2 release soon.
markie