Ajaxing a Full Node View into a right column block from links in a list of Apache SOLR Facet Builder Search results, the full node does display, except for OSM player - only this displays -
OSM Player:
00:00
00:00
... but no actual player.
If I just browse the View normally, all is well and the OSM player is there and working. If I switch the View Row Style to Fields and add just my Mediafront preset, the rest of the node display is excluded and output is only the above.
I posted category as "support" but travist, if you see this (really hoping so), of course feel free to change to a bug if that turns out to be the case, which I think it might but I don't want to unnecessarily clog up your bug queue being wrong.
Comments
Comment #1
butler commentedA clarification - when I wrote:
"If I switch the View Row Style to Fields and add just my Mediafront preset, the rest of the node display is excluded and output is only the above"
... I meant "WHEN TARGETING THE VIEW TO THE RIGHT COLUMN if I switch the View Row Style to Fields and add just my Mediafront preset, the rest of the node display is excluded and output is only the above."
Comment #2
butler commentedBump?
Comment #3
butler commentedThe OSM PLayer will not display for a Node (not a View of a node) "Ahah-ed" into a right column block either - in order to see if the problem was with Views I tried rewriting my module slightly without Views so callback function is like so:
... same behavior: node displays dynamically in right column block but without the OSM Player. OSM Player displays fine if the node is loaded normally (not asynchronously/via javascript) into a block with a new page though.
Except it is noticeably faster than it was using Views so I will probably stick with it this way. This seems to point to a problem with OSM Player at this point - why would node_view() not be able to access the player via Ahah/JQuery but would when loading a page normally?
Comment #4
travist commentedI am pretty sure this is because the CSS or JS files are not getting added to the page. What happens when you explicitly add them to the page before you drupal_json the player onto the page?
I haven't actually tested this code, but it is worth a shot.
Comment #5
butler commentedThanks very much for your reply travist. Will try this in a bit, will advise.
Comment #6
butler commentedWell, I added the code provided above by travist to the div I am targeting and the player does indeed show up. However, it still won't play the Audio node. I am guessing either I need to somehow provide $nid explicitly again to the player (maybe in my Drupal.behaviors function?) or maybe the osmplayer_functions() code should go my the callback function?
If I'm correct above, this brings up the question of how/why the player is not "aware" of the Audio node only when drupal_json-ed onto the page? Is this actually a bug, or am I just trying to do something that isn't really provided for out out of the box by the OSM Player?
Thanks also travist for pointing out the correct verb - to "drupal_json" ;)
Comment #7
butler commentedNothing I can figure out will get the player to play the Audio node it is loading with. This would seem to be a bug... travist? Any workaround?
Comment #8
butler commentedBump?
Comment #9
travist commentedbutler,
It sounds like you will need to explicitly load the node into the media player since you have an unusual use case. You can do this within JavaScript using the loadNode function on the node object. Here is a little example of what I am talking about...
You will replace the PRESETNAME with the name of your preset, and NODEID with the node id for the node you wish to load.
I hope this provides you some more assistance.
Travis.
Comment #10
travist commentedI also need to mention that the "mediafront_PRESETNAME_0" is most likely going to change in a future release to just say "mediafront_PRESETNAME" unless there are more then one player on the page, which they would then include the instance number. I realized that I may have broken some tutorials due to this change to include instances, so just keep in mind that a future release will have that change.
Comment #11
butler commentedTravist, thanks very much, but after trying to understand, I still don't get where to put the js code from your comment 9 above. I would hugely appreciate any further direction you could provide.
To recap at this point (with a lot of help from zzadik) I have hacked together a module which works in conjunction with adding your code from comment 4 to the block I am trying to dynamically update, to display the OMS player and other content from the node in question (although again, the player still won't play the audio associated with the Audio node in question) in a block dynamically.
Where should the javascript you provided in comment 9 go - should it be in the block? Or should it be within the .js file called by my module via drupal_add_js() in order to accomplish updating the block via Json? Or...?
Then there is the question of how to provide Node ID. Node ID HAS been made available dynamically within the targeted block since node content is successfully/correctly loading into the block. So would that mean I can just provide that to the OMS player after all Json-ing has been accomplished - i.e. by figuring out what variable contains node ID?
Any further help would be greatly appreciated. Thanks very much again...
Comment #12
travist commentedbutler,
The code above just needs to be added using drupal_add_js like the following php code....
This should then execute the callback function when the player has finished loading... As for passing the NID along, you mentioned that the NID is provided dynamically. I cannot say how that is provided since I didn't implement what it is you are doing, but yes.... the NID should be available somehow, and you can just refer to that dynamic variable instead of hard-coding the NID value.
This is the most direction I can provide. Your use case is very custom, so I just don't know for sure how all the variables are passed around, but with a little debugging, this should put you at least on the right path.
Hope this helps.
Travis.
Comment #13
butler commentedThanks again travist. I tried this in various ways with a hard-coded nid (to at least take that out of the equation for the moment):
- in the target block before and after the code you gave me to load OSM Player js and css,
- in the drupal_add_js statement in my module that calls the .js doc that does Json stuff
- at various points within the .js doc that does Json stuff
... and still no joy.
Would you consider consulting on this for an hour or 2 for pay? I tried emailing you re: this via Drupal site contact form but received no reply either way - please let me know whether or not you would consider this? Thanks much for all your help either way.