Forumlar / Cotonti / Extensions / Working on a plugin...

SunChase
#1 2009-09-24 01:57
I want to make a plugin for youtube and ect that would replace all of the standart players of the sites and change them to 1 universal player.

I found only 1 script that does that,but i dont know much in java.
Could someone please explain this java script:

<?if($OTHER2$)?> 
<script type='text/javascript' src='http://muz-bullet.3dn.ru/url/swfobject.js'></script> 
<p class="media2" id="preview">$ENTRY_NAME$!</p> 
  <script type="text/javascript"> 
  var s1 = new SWFObject("http://muz-bullet.3dn.ru/mediaplayer.swf","player","610","413","9","#ffffff"); 
  s1.addParam("allowfullscreen","true"); 
  s1.addParam("allowscriptaccess","always"); 
  s1.addParam("wmode","opaque"); 
  s1.addParam("flashvars","file=&file=$OTHER2$&controlbar=over&type=youtube&icons=false&title=$ENTRY_NAME&image=http://muz-bullet.3dn.ru/images/i_header.jpg&backcolor=000000&skin=http://muz-bullet.3dn.ru/web/overlay.swf&dock=false&quality=false"); 
  s1.write("preview"); 
  </script><?endif?>
[url=http://ka13.orgfree.com]KA13[/url] - The essence of creativity
Trustmaster
#2 2009-09-24 02:34
It creates a new SWF object and assigns several object parameters.
May the Source be with you!
Mynt
#3 2009-09-25 03:46
Your going to have to add a check/balancer.

First you will have to have a URL cleaner, that will basically detect where the source is. Main reason why is Youtube, Dailymotion/Cafe, Break.com and other websites use different Params passed.

Because your going to have to overwrite the old API of youtube and othersites, your going to need to incorperate: http://code.google.com/p/swfobject/ *SWFObject* which is a free javascript API library to allow you to pass commands freely from SWF objects embedded in the site to Javascript so it can communicate freely with PHP without reloads. Think of it kinda like jQuery for Flash Embeds.

You also would want to look here:
http://code.google.com/apis/youtube/getting_started.html#player_apis

Its alot of work.. but when you start getting everything together its easy to maintain. I will help out with debugging where I can if you need it.

-Mynt
"I only sleep when I know I won't miss a thing."
SunChase
#4 2009-09-25 18:38
Thanks Mynt.I think i will need help on this plugin.

You're right about the URL cleaner.I have been looking for it for 4 days now and still haven't found something that would actually work.

But the main problem is to make something universal,so people would be able to add other video resources the in the simplest way.But i think i will do this in the second version of the plugin.

Also if you know some good player that would work normally with url's and have the option to load couple of times on one page please post here atleast its name.
[url=http://ka13.orgfree.com]KA13[/url] - The essence of creativity
Mynt
#5 2009-10-04 02:08
To help out here is some resource links I gathered for you:

FLV PLAYER:
http://www.osflv.com/

This will help you learn about API in the documentation for sending flash vars to the SWF.

For the Player itself, I highly reccomend:
http://www.longtailvideo.com/players/jw-flv-player/

As it supports a multitude of flash media

As for your URL stripper, heres something for Youtube.. Note it might have to be editted but you get the jist:

function get_link($url){ 
if ($html = file_get_contents($url)){ 
if(preg_match_all("/\b(?:video_id)\b:.*/", $html, $matches)){ 
$ref = $matches[0][0]; 
//echo $ref.'<br>'; 
preg_match_all("/\'[^\'\\\\\r\n]*(?:\\\\.[^\'\\\\\r\n]*)*\'/", $ref, $match); 
//video_id:'WAvj0iY1Zig',l:'142',t:'OEgsToPDskLspgdtd49MOElkAv_WEJmW',sk:'2ZgBZFfneV2DzW3Zb8g2AAC1 
//print_r ($match); 
$id1 = str_replace("'", "", $match[0][0]); 
$id2 = str_replace("'", "", $match[0][2]); 
$id3 = str_replace("'", "", $match[0][3]); 
$id = $id1.'&t='.$id2.'&sk='.$id3; 
//echo $id; 
$url = 'http://youtube.com/get_video.php?video_id='.$id; 
$url = get_headers($url); 
//$url = print_r($url); 
$url = $url[9]; 
//echo $id; 
$url = substr($url,10); 
$url = $url.'.flv'; 

//echo $url; 
return $url; 
} 
return false; 
} 
} 

And ofcourse heres something you can part through to find out how each url from a variety of places parse there media.

http://userscripts.org/scripts/review/47636


Hope this helps out!

-Mynt
"I only sleep when I know I won't miss a thing."