diff --git a/web/includes/functions.php b/web/includes/functions.php index d7ae4c95b..abf6246b3 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -217,14 +217,20 @@ function getMimeType( $file ) return( trim( exec( 'file -bi '.escapeshellarg( $file ).' 2>/dev/null' ) ) ); } -function outputVideoStream( $id, $src, $width, $height, $format, $title="" ) -{ - if ( file_exists( $src ) ) +function outputVideoStream( $id, $src, $width, $height, $format, $title="" ) { + echo getVideoStreamHTML( $id, $src, $width, $height, $format, $title ); +} + +function getVideoStreamHTML( $id, $src, $width, $height, $format, $title="" ) { + $html = ''; + $width = validInt($width); + $height = validInt($height); + $title = validHtmlStr($title); + + if ( file_exists( $src ) ) { $mimeType = getMimeType( $src ); - else - { - switch( $format ) - { + } else { + switch( $format ) { case 'asf' : $mimeType = "video/x-ms-asf"; break; @@ -252,118 +258,95 @@ function outputVideoStream( $id, $src, $width, $height, $format, $title="" ) } if ( !$mimeType || ($mimeType == 'application/octet-stream') ) $mimeType = 'video/'.$format; - $objectTag = false; - if ( ZM_WEB_USE_OBJECT_TAGS ) - { - switch( $mimeType ) - { + if ( ZM_WEB_USE_OBJECT_TAGS ) { + switch( $mimeType ) { case "video/x-ms-asf" : case "video/x-msvideo" : case "video/mp4" : { - if ( isWindows() ) - { - ?> - - + type="'.$mimeType.'"> + - - - '; } - break; } case "video/quicktime" : { - ?> - - + type="'.$mimeType.'"> + - - - '; } case "application/x-shockwave-flash" : { - ?> - - + type="'.$mimeType.'"> + - - - '; } - } - } - if ( !$objectTag ) - { - ?> - - src="" - name="" - width="" - height="" + } # end switch + } # end if use object tags + return ' - - '; } -function outputImageStream( $id, $src, $width, $height, $title="" ) -{ +function outputImageStream( $id, $src, $width, $height, $title="" ) { + echo getImageStream( $id, $src, $width, $height, $title ); +} + + +function getImageStream( $id, $src, $width, $height, $title="" ) { if ( canStreamIframe() ) { - ?> -