Great module... thanks! I like the style "pluggability" and the other progress others made with exclusions and other transformations.
My use-case for JW Player would also apply to any other video players that have a JS API and/or XML Namespace I believe. This project uses a licensed JW Player so it didnt have a budget for using true mRSS specification. Exclude wont fit this use case since some fields come from file_entity. True mRSS, particularly for the "media:content", is either a quoted array inside the tag or single quoted values within each tag.
<media:content
url="http://www.foo.com/movie.mp4"
thumbnail="http://www.foo.com/movie-move.jpg"
fileSize="12216320"
type="video/quicktime"
medium="video"
isDefault="true"
expression="full"
bitrate="128"
framerate="25"
samplingrate="44.1"
channels="2"
duration="185"
height="200"
width="300"
lang="en" />
or
<media:content url="http://www.foo.com/movie.mp4" />
<media:thumbnail url="http://www.foo.com/movie-move.jpg" />
So to do real mRSS obviously poses trouble but wondered if anyone has worked on adding that as a style to this module?
I hijacked the XML style and only modifed the header, body and footer templates and added a few lines of code to eliminate drupal-inserted multiple line breaks, spaces and space/line-break combinations to get it to render on one line. Even with strip html and remove whitespace on a field a whole bunch of garbage is output with fields that come from "file_entity -> Video File -> Fields assigned to that style
views-data-export-xml-header.tpl.php
<?php
/**
* @file views-view-table.tpl.php
* Template to display a view as a table.
*
* - $title : The title of this group of rows. May be empty.
* - $rows: An array of row items. Each row is an array of content
* keyed by field ID.
* - $header: an array of headers(labels) for fields.
* - $themed_rows: a array of rows with themed fields.
* @ingroup views_templates
*/
// Short tags act bad below in the html so we print it here.
//print '<?xml version="1.0" encoding="UTF-8"
/*<<?php print $root_node; ?>> ?>';*/
print '<rss xmlns:jwplayer="http://developer.longtailvideo.com/trac/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">';
?>
<?php print '
<channel>';?>
<?php print '
<title>JW Player Video Playlist</title>'
;?>views-data-export-xml-body.tpl.php
<?php
/**
* @file views-view-table.tpl.php
* Template to display a view as a table.
*
* - $title : The title of this group of rows. May be empty.
* - $rows: An array of row items. Each row is an array of content
* keyed by field ID.
* - $header: an array of headers(labels) for fields.
* - $themed_rows: a array of rows with themed fields.
* @ingroup views_templates
DRIVE: $item_item defined here as workaround from default "$item_node"
item could be hardcoded, this only replicates orig template structure
*/
$item_item = 'item';
?>
<?php foreach ($themed_rows as $count => $row): ?>
<<?php print $item_item; ?>>
<?php foreach ($row as $field => $content): ?>
<<?php print $xml_tag[$field]; ?>><?php print $content; ?></<?php print $xml_tag[$field]; ?>>
<?php endforeach; ?>
</<?php print $item_item; ?>>
<?php endforeach; ?>views-data-export-xml-footer.tpl.php
<?php //print $root_node; ?>
<?php print ' </channel>';?>
<?php print '
</rss>';?>views_data_export.theme.inc
/**
* Preprocess xml output template.
*/
function template_preprocess_views_data_export_xml_body(&$vars) {
_views_data_export_header_shared_preprocess($vars);
_views_data_export_body_shared_preprocess($vars);
// Compute the tag name based on the views base table, minus any trailing 's'.
$vars['item_node'] = _views_data_export_xml_tag_clean(rtrim($vars['view']->base_table, 's'));
foreach ($vars['themed_rows'] as $num => $row) {
foreach ($row as $field => $content) {
// Prevent double encoding of the ampersand. Look for the entities produced by check_plain().
$content = preg_replace('/&(?!(amp|quot|#039|lt|gt);)/', '&', $content);
// Convert < and > to HTML entities.
$content = str_replace(
array('<', '>'),
array('<', '>'),
$content);
//
// DRIVE - ADDED LINE TO REMOVE LINE RETURNS AND SPACES FROM DRUPAL OUTPUT
//
$content = preg_replace(array('/\\\\n/'), '', $content);
$content = preg_replace(array('/\\n/'), '', $content);
$content = preg_replace(array('/\\s\s/'), '', $content);
$content = preg_replace('/\/ /', '/', $content);
$vars['themed_rows'][$num][$field] = $content;
}
}I added a Node template according to my view and put it in mytheme/templates/node--video_article.tpl.php which is the proper naming convention for my content-type which is "video_article". I attached that template as well. It has two sections which outputs a simple one-video player in teasers (default JW skin) and the full player with playlist in node view with a custom skin.
I know we should use GIT and so forth but time constraints limit to this example of using JW Player playlist mixing with mRSS (only 'description' field but mixed nevertheless).
Small adaptations to this example would work for other players like MediaFront I believe.
*It is very hard to find info on xml playlist generation. PPL who know how don't often share so this example aims at using Views Data Export to create playlists, particularly on nodes, that can also be shared across domains by using a cross-domain XML file.
**If using MP4's see H.264 codec if you have streaming trouble
***Relevance: desire to see true mRSS Style in this module down the road :)
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | node--video_article.tpl_.txt | 4.49 KB | DRIVE |
| video_article_playlist-thumbs-1.xml_.txt | 3.7 KB | DRIVE | |
| video_article_playlist_thumbs-view-export.txt | 18.9 KB | DRIVE | |
| view-video-playlist-view-edit-data-export-notation.png | 289.08 KB | DRIVE |
Comments
Comment #1
DRIVE commentedMy mytheme/templates/node--article_video.tpl.php template:
Comment #2
DRIVE commentedNOTE: This template comes from a sub-theme of OMEGA using HTML5
Comment #3
kingandyThanks for these templates! It would be nifty to be able to manually set the $root_node (eg "channel") and $item_node (eg "item") within the views UI, but I guess that's a subtly different issue...
Comment #3.0
kingandySupplement: link to cross-domain xml file
Comment #4
decibel.places commentedInteresting approach. I read this, but I opted to create the playlist in RSS/XML and display the player in a block without any tpl files here is my blog post
Comment #5
DRIVE commented@#4 -- thanks for the information - nice blog post but when I tried to view your working example I received page-not-found. Is there a link to your working example?
Comment #6
decibel.places commented@ #5 the link is correct http://proudcampus.com/
we had some uptime issues caused by another dev misconfiguring the Ultimate Cron module
Comment #7
DRIVE commentedVery good.... looks nice. Lots of nice goodies in the site... .kudos
Comment #8
steven jones commentedAs per https://drupal.org/node/2204803
Comment #9
steven jones commentedSorry for the lack of attention to your issue, please accept my apologies.
Drupal 7 is going to be end-of-life'd by the community in approximately 1 month.
As such, I am closing all non-critical looking, non-PHP compatibility issues for Views Data Export to tidy up the issue queues and reduce the noise. You can read about this on #3492246: Close down Drupal 7 issues.
If you feel like this issue has been closed by mistake, please do comment about re-opening it.
If you feel like the ticket is still relevant for the 8.x-1.x version of the module, then please search for a duplicate issue first, and if there really isn't one (and you've looked properly) then change the version on the ticket and re-open.
Thanks to everyone involved in this issue: for reporting it, and moving it along, it is truly appreciated.
The Drupal community wouldn't be what it is today without your involvement and effort, so I'm sorry that we couldn't get this issue resolved. Hopefully we'll work together in a future issue though, and get that one resolved :)