Permalink
Browse files

Updated with MediaMosa hacks.

Added hacks to work around MediaMosa outputting RTMP streams as 'plain'
play ticket instead of download URL and updated example and demo.
  • Loading branch information...
1 parent cc14307 commit b039560191595244221e13dcb87d9eaffcf2c4bd @thijsz thijsz committed Dec 13, 2011
View
@@ -0,0 +1,22 @@
+The Fideo module is a Drupal module that demonstrates the working of the HTML5
+based multisource player. It is in beta and does not fully support all
+browsers. It's just a prototype. The 2.x version will be based around VideoJS
+3.x which will be released soon.
+
+The HTML5 player-part of Fideo is based on VideoJS (www.videojs.com), which is
+licensed under LGPLv2. It uses Flowplayer as fallback player for browsers that
+do not support HTML5 video. Because Flowplayer is included in this version of
+the module, it cannot be published under the GPLv2 license (like most Drupal
+modules), but is published under the GPLv3 license.
+
+The Fideo project is started as an initiative for an open source videoplayer
+for the open source project MediaMosa.
+
+An overhauled and less prototype-like version is in the works, this will be
+released in the beginning of 2012.
+
+Developed by One Shoe
+http://www.oneshoe.nl
+
+MediaMosa
+http://mediamosa.org
View
@@ -8,7 +8,7 @@ see an example, check out example.html in the 'example' directory.
2. Install the Drupal module "Fideo" by going to admin/build/modules.
-3. Check out the demo page by going to the path 'fideo'.
+3. Check out the demo page by going to the path 'fideo' in your Drupal install.
4. In the fideo.demo.inc is a function called fideo_format() which presents the
data structure for video files. Take that format and use it in your own
@@ -1,4 +1,4 @@
-
+// $Id: fideo.js 276 2011-12-05 09:07:33Z thijs $
var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} };
Drupal.settings.fideo = {};
Drupal.fideoCache = {};
@@ -451,4 +451,4 @@ if (typeof(Drupal.attachBehaviors) == 'undefined') {
});
}
-})(jQuery);
+})(jQuery);
Binary file not shown.
@@ -142,4 +142,4 @@
#fideo.fullscreen #fideo-markers {
bottom: 0px;
-}
+}
@@ -2,9 +2,9 @@
<html class="js">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<title>MediaMosa player 1.1-beta2</title>
+<title>MediaMosa player 1.1-beta3</title>
<!--
- $Id: example.html 216 2011-11-23 09:05:26Z thijs $
+ $Id: example.html 287 2011-12-13 13:03:46Z thijs $
=============================================================================
MediaMosa Multisource Player
@@ -24,14 +24,14 @@
<link type="text/css" rel="stylesheet" media="all" href="example.css" />
<!-- CSS needed for the player -->
-<link type="text/css" rel="stylesheet" media="screen" href="../assets/video-js.css?h" />
-<link type="text/css" rel="stylesheet" media="screen" href="../assets/video.css?h" />
+<link type="text/css" rel="stylesheet" media="screen" href="../assets/video-js.css?i" />
+<link type="text/css" rel="stylesheet" media="screen" href="../assets/video.css?i" />
<!-- Javascript files for the player -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
-<script type="text/javascript" src="../assets/video.js?h"></script>
-<script type="text/javascript" src="../assets/fideo.js?h"></script>
-<script type="text/javascript" src="../assets/qtip/jquery.qtip-1.0.0-rc3.min.js?h"></script>
+<script type="text/javascript" src="../assets/video.js?i"></script>
+<script type="text/javascript" src="../assets/fideo.js?i"></script>
+<script type="text/javascript" src="../assets/qtip/jquery.qtip-1.0.0-rc3.min.js?i"></script>
<!-- Configuration -->
<script type="text/javascript">
@@ -1,4 +1,5 @@
<?php
+// $Id: fideo.admin.inc 205 2011-11-21 13:55:41Z thijs $
/**
* @file
View
@@ -1,4 +1,5 @@
<?php
+// $Id: fideo.demo.inc 287 2011-12-13 13:03:46Z thijs $
/**
* @file
@@ -21,30 +22,30 @@ function fideo_format() {
'height' => 400,
'controls' => 'controls',
),
- '#poster' => base_path() .'assets/video/mozcamp_still.jpg',
+ '#poster' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp_still.jpg',
array(
'#type' => 'source',
'#mimetype' => 'video/mp4',
'#codecs' => 'avc1.42E01E, mp4a.40.2',
- '#file' => base_path() .'assets/video/mozcamp.handbrake.mp4?1',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.handbrake.mp4?1',
),
'webm' => array(
'#type' => 'source',
'#mimetype' => 'video/webm',
'#codecs' => 'vp8, vorbis',
- '#file' => base_path() .'assets/video/mozcamp.ffmpeg.webm?1',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.ffmpeg.webm?1',
),
'ogv' => array(
'#type' => 'source',
'#mimetype' => 'video/ogg',
'#codecs' => 'theora, vorbis',
- '#file' => base_path() .'assets/video/mozcamp.ffmpeg.ogv?1',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.ffmpeg.ogv?1',
),
array(
'#type' => 'subtitles',
'#lang' => 'nl',
'#title' => t('Dutch'),
- '#file' => base_path() .'assets/video/mozcamp.captions.srt',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.captions.srt',
),
),
'secondary' => array(
@@ -54,24 +55,24 @@ function fideo_format() {
'#attributes' => array(
'width' => 267, 'height' => 200, 'controls' => 'controls',
),
- '#poster' => base_path() .'assets/video/mozcamp_slide.jpg',
+ '#poster' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp_slide.jpg',
array(
'#type' => 'source',
'#mimetype' => 'video/mp4',
'#codecs' => 'avc1.42E01E, mp4a.40.2',
- '#file' => base_path() .'assets/video/mozcamp.handbrake.mp4?2',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.handbrake.mp4?2',
),
'webm' => array(
'#type' => 'source',
'#mimetype' => 'video/webm',
'#codecs' => 'vp8, vorbis',
- '#file' => base_path() .'assets/video/mozcamp.ffmpeg.webm?2',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.ffmpeg.webm?2',
),
'ogv' => array(
'#type' => 'source',
'#mimetype' => 'video/ogg',
'#codecs' => 'theora, vorbis',
- '#file' => base_path() .'assets/video/mozcamp.ffmpeg.ogv?2',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/video/mozcamp.ffmpeg.ogv?2',
),
),
'slides' => array(
@@ -143,7 +144,7 @@ www.mozilla-europe.org',
$media['slides'][$i] = array(
'#type' => 'slide',
'#start' => $timecodes[$i],
- '#file' => base_path() .'assets/stills/'. str_pad($i, 3, '0', STR_PAD_LEFT) .'.jpg',
+ '#file' => 'http://labs.oneshoe.nl/fideo/assets/stills/'. str_pad($i, 3, '0', STR_PAD_LEFT) . '.jpg',
'#alt' => $alts[$i],
);
}
@@ -177,7 +178,7 @@ www.mozilla-europe.org',
'#type' => 'marker',
'#start' => 600.3,
'#end' => 650.4,
- '#value' => '<img src="'. base_path() .'assets/stills/firefox_logo.png" width="100" height="100" alt="FireFox" /><br />The FireFox browser.',
+ '#value' => '<img src="http://labs.oneshoe.nl/fideo/assets/stills/firefox_logo.png" width="100" height="100" alt="FireFox" /><br />The FireFox browser.',
);
// Create a wrapper.
View
@@ -1,7 +1,8 @@
+; $Id: fideo.info 286 2011-12-13 12:55:28Z thijs $
name = Fideo
description = "An open video implementation module for MediaMosa."
package = MediaMosa
core = 7.x
-version = "7.x-1.1-beta2"
+version = "7.x-1.1-beta3"
files[] = tests/fideo.test
View
@@ -1,4 +1,5 @@
<?php
+// $Id: fideo.module 286 2011-12-13 12:55:28Z thijs $
/**
* @file
@@ -118,6 +119,8 @@ function fideo_fideo_elements() {
'#skip_assets' => FALSE,
'#attributes' => array(),
+ '#pre_render' => array('_fideo_pre_render_video'),
+
'#value' => NULL,
'#prefix' => '',
'#suffix' => '',
@@ -1,4 +1,5 @@
<?php
+// $Id: fideo.render.inc 286 2011-12-13 12:55:28Z thijs $
/**
* @file
@@ -33,9 +34,6 @@ function _fideo_render(&$elements) {
}
$content = '';
- if (!isset($elements['#sorted'])) {
- //uasort($elements, "element_sort");
- }
if (!isset($elements['#children'])) {
$children = element_children($elements);
@@ -153,6 +151,45 @@ function _fideo_pre_render_video($element) {
);
}
}
+
+ // Hackish fixes for MediaMosa that sometimes returns a streaming server
+ // address to a video file. In that case, skip the source for HTML5. Also,
+ // MediaMosa sometimes returns ticket URL's without file extension, making it
+ // harder for certain browsers to recognize files when mimetype isn't enough.
+ $sources = _fideo_element_by_type($element, 'source');
+ foreach ($sources as $key) {
+ if (!empty($element[$key]['#file'])) {
+ $file = $element[$key]['#file'];
+ // MediaMosa returns a streaming URL, even when 'plain' is supplied. In
+ // that case, skip the item in normal rendering.
+ if (!(drupal_substr($file, 0, 4) == 'http' && strpos($file, '://') !== FALSE && strpos($file, '://') <= 5)) {
+ $element[$key]['#skip'] = TRUE;
+ // No extension checking needed here anymore.
+ continue;
+ }
+
+ // When no extension is found, fake an extension to help out some
+ // browsers that have difficulty finding playable sources by mimetype.
+ $extension = (strrpos($file, '.') !== FALSE ? drupal_substr($file, strrpos($file, '.') + 1) : '');
+ if ((!$extension || drupal_strlen($extension) >= 4) && isset($element[$key]['#mimetype'])) {
+ switch ($element[$key]['#mimetype']) {
+ case 'video/mp4':
+ $extension = 'mp4';
+ break;
+ case 'video/webm':
+ $extension = 'webm';
+ break;
+ case 'video/ogv':
+ $extension = 'ogg';
+ break;
+ }
+ if ($extension) {
+ $element[$key]['#file'] .= (strpos($element[$key]['#file'], '?') ? '&' : '?') . 'ext.' . $extension;
+ }
+ }
+ }
+ }
+
if (!empty($element['tracks'])) {
foreach (element_children($element['tracks']) as $key) {
$element['tracks'][$key] += array(
@@ -198,7 +235,9 @@ function _fideo_fallback_flashvars($element, $source) {
// Build up the playlist.
if (!empty($element['#poster'])) {
// Add the poster as first item in the playlist array.
- $playlist[] = $element['#poster'];
+ // @todo Removed poster image because MediaMosa returns stills without
+ // extension and this is something Flowplayer can't handle.
+ //$playlist[] = $element['#poster'];
}
// Main video item.
@@ -208,6 +247,21 @@ function _fideo_fallback_flashvars($element, $source) {
'autoPlay' => ($element['#autoplay'] ? TRUE : FALSE),
);
+ // Hack for RTMP streams, unfortunately needed because MediaMosa keeps
+ // acting up.
+ if (drupal_strtolower(drupal_substr($source['#file'], 0, 7)) == 'rtmp://') {
+ // Explode on ampersand to separate file and server.
+ // @todo This is super ugly, find a more stable way to do this.
+ $parts = explode('&file=', $source['#file'], 2);
+
+ $clip['provider'] = 'rtmp';
+ $clip['url'] = 'mp4:' . $parts[1];
+ $plugins['rtmp'] = array(
+ 'url' => 'flowplayer.rtmp-3.2.3.swf',
+ 'netConnectionUrl' => $parts[0],
+ );
+ }
+
if ($tracks = _fideo_element_by_type($element, array('captions', 'subtitles', 'track'))) {
// Find captions or subtitles, and use only the first one. Beware that
// Flowplayer only supports *.srt subtitles.
@@ -218,6 +272,7 @@ function _fideo_fallback_flashvars($element, $source) {
'url' => 'flowplayer.captions-3.2.2.swf',
'captionTarget' => 'content',
);
+
$plugins['content'] = array(
'url' => 'flowplayer.content-3.2.0.swf',
'bottom' => 5,
Oops, something went wrong.

0 comments on commit b039560

Please sign in to comment.