magentojwplayershadowbox

How to Play Avi, Flv File in backend magento


I have a custom module in which i add video files from my magento back-end to a specific album. Files are uploaded locally or embedded through URL. To view already uploaded files I added a link from which user can play the Current Uploaded file or can be played through saved URL and 'File Browse Button' to upload a new one. I have used Shadowbox and jwplayer for this purpose. From URL video just played fine but for locally uploaded file if it is in AVI Format, both players didn't work for AVI format

Here is My Code

JWPlayer which can't support Avi Format

jwplayer('sb-body-inner').setup({ file: url, width: '380', height: '270', autostart: 'true', image: img, });

and Shadow Box Player

Shadowbox.init({ handleOversize: 'resize', flashVars: { skin: '".Mage::getBaseUrl('js').'mediaappearance/skin01.zip'."',}, overlayOpacity: 0.8, });

Also My anchor tag is from which i call jwplayer or shadowbox

    `<a href="'.$withfunction.'" rel="'.$videoRel.'">View current file</a>'`

Thanks in Advance for help

Here is the Screen Shot to better explain my case Add Media Album


Solution

  • Create an array of all the file types you want Shadowbox to play included avi,flv etc

    var FileTypesToPlay = { flv:['flv'], qtwmp:['avi', 'mpg', 'mpeg'], qt:['dv', 'mov', 'moov', 'movie', 'mp4'], };

    And write the Shadowbox.open like that

    Shadowbox.open({ content: 'Your File Path Url', players: [ 'flv', 'qt', 'qtwmp'] ext: '+FileTypesToPlay+' });

    Read the Shadowbox documentation also : http://www.shadowbox-js.com/usage.html