IT Community - Software Programming, Web Development and Technical Support

Play Youtube videos into my Flash video player

This is a discussion on Play Youtube videos into my Flash video player within the Flash Actionscript Programming forums, part of the Web Development category; Hi, I am trying to play the Youtube videos into my Flash player. I got video details from an xml ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Flash Actionscript Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 03-11-2008, 03:36 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 632
oxygen is on a distinguished road
Default Play Youtube videos into my Flash video player

Hi,
I am trying to play the Youtube videos into my Flash player. I got video details from an xml file provided by the Youtube Api. But i cant able to play the videos. Can anyone help me to finish my work successfully.

Thanks in Advance.
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...

Last edited by oxygen : 03-11-2008 at 03:39 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-15-2008, 02:13 AM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 72
aramesh is on a distinguished road
Default Re: Play Youtube videos into my Flash video player

Hi,

You can get the video id from the xml file is it right. Then its simple to play.
1) First create a movieclip and place outside the stage area. And name it as "loadmc".
2)Then place a video object on to the stage. and name it as "videoPlayBack".
3) Attach these codes in the first Frame.
Code:
	var nc:NetConnection = new NetConnection();
	nc.connect(null);
	var ns:NetStream = new NetStream(nc);
	ns.setBufferTime(5);
	videoPlayBack.attachVideo(ns);

	//http://www.youtube.com/watch?v=j_GADQv3vKs

	var _mcl:MovieClipLoader = new MovieClipLoader ();
	var _mcllistener:Object = new Object();
	_mcl.addListener(_mcllistener);
	
	_mcllistener.onLoadInit=function(target:MovieClip){
		var _lv:LoadVars = new LoadVars ();
		_lv.decode (target._url.split ("?")[1]);
		var str:String = "http://www.youtube.com/get_video.php?";
		str += "video_id=" + _lv.video_id;
    	str += "&t=" + _lv.t;
		trace(_lv.t);
		clearInterval(my_interval);
		ns.close();
		ns.play(str);
 	    _mcl.unloadClip (target);
	}
	
	function getTrack_Id(id){
		_mcl.loadClip("http://www.youtube.com/v/"+id,loadmc);
	}
	getTrack_Id("Z5hmHDXiwA4")
4) In this "Z5hmHDXiwA4" is the video id.
__________________
A.Ramesh
Failure is not the End…it is your stepping stone to success!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 01-13-2009, 10:20 AM
wgator wgator is offline
D-Web Trainee
 
Join Date: Jan 2009
Posts: 1
wgator is on a distinguished road
Default Re: Play Youtube videos into my Flash video player

I having trouble getting this to work. Do you have a working sample?

Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 04-22-2009, 04:54 PM
latergator latergator is offline
D-Web Trainee
 
Join Date: Apr 2009
Posts: 1
latergator is on a distinguished road
Default Re: Play Youtube videos into my Flash video player

Quote:
Originally Posted by wgator View Post
I having trouble getting this to work. Do you have a working sample? Thanks
I tried that example too but it seems to get stuck trying to contact youtube.com

Then I found this code which is much much simpler. Don't need to create any elements just past the actionscript in the first frame. You may need to test this on a server to see it really work.

Code:
var id = "4YBxeDN4tbk";
this.createEmptyMovieClip("video_mc", 10000);
this.video_mc.loadMovie("http://www.youtube.com/v/"+id);
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
to play video files in VB.NEt application arjkhanna VB.NET Programming 3 10-02-2009 01:02 AM
Sharing: How to make a video sharing website like YouTube Shirley1874 HTML, CSS and Javascript Coding Techniques 5 09-24-2009 07:34 PM
How to play the videos in PHP Vani Sri PHP Programming 8 01-19-2009 05:55 PM
media player not playing videos in web design. suman Web Design Help 1 08-19-2008 11:47 PM
How to Add Flash, Video, and Audio to Web Pages killerkev06 Web Design Help 3 03-22-2007 03:46 AM


All times are GMT -7. The time now is 07:50 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0