WonderflでYoutubeの動画を使うには?
forked from Wonderflで使いたい画像を簡単にアップロード (diff: 52)
追記:自己解決しました (I can find the solution of this problem, thank you.) http://wonderfl.net/code/ecdf095f099ae22c50bf08afe6445b44b60a482c 今度はyoutubeの動画利用に挑戦 ・・・・・・してみたがうまくいかないのでquestionタグをつけておく。 "related video:"にURLを貼りつけて,それからどうすればいいのでしょう?? 超適当に英文も書いとく。 I will use YOUTUBE's video. * On wonderfl, I pasted URL of YOUTUBE's video to * "related video:" textBox. * After that, What I have to do ??
ActionScript3 source code
/**
* Copyright Nicolas ( http://wonderfl.net/user/Nicolas )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/l5ch
*/
// forked from Nicolas's Wonderflで使いたい画像を簡単にアップロード
//追記:自己解決しました
//(I can find the solution of this problem, thank you.)
//http://wonderfl.net/code/ecdf095f099ae22c50bf08afe6445b44b60a482c
//今度はyoutubeの動画利用に挑戦
//・・・・・・してみたがうまくいかないのでquestionタグをつけておく。
//"related video:"にURLを貼りつけて,それからどうすればいいのでしょう??
//超適当に英文も書いとく。
/* I will use YOUTUBE's video.
* On wonderfl, I pasted URL of YOUTUBE's video to
* "related video:" textBox.
* After that, What I have to do ??
*/
package {
import flash.display.Sprite;
import flash.events.*;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class FlashTest extends Sprite {
//youtubeのURL
private var url:String = "http://www.youtube.com/watch?v=eVr99aI6-qs"
private var nc:NetConnection;
private var ns:NetStream;
public function FlashTest() {
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nc.connect(null);
}
private function netStatusHandler(e:NetStatusEvent):void {
if (e.info.code == "NetConnection.Connect.Success") {
connectStream();
}
}
private function connectStream():void {
ns = new NetStream(nc);
var video:Video = new Video();
video.attachNetStream(ns);
ns.play(url);
addChild(video);
}
}
}
