2007年04月13日

メモ:Youtubeプレイヤのデコン

※読み物ではありません。

YouTubeのFlashプレイヤーのswfファイルを[Flare]で、デコンパイルした。アクションスクリプトが丸見えに。

movie 'p.swf' { // flash 7, total frames: 1, frame rate: 25 fps, 450x356 px, compressed

movieClip 2 {
}

movieClip 3 {
}

movieClip 6 {
}

movieClip 11 {
}

movieClip 13 StaticShare {

frame 1 {
share_url_field.text = share_url;
if (_parent.videoDisplay._width > this._width) {
this._width = _parent.videoDisplay._widt;
this._yscale = this._xscale;
}
}
}

movieClip 15 new_slider {
}

movieClip 26 ShareLogoButtons {
}

movieClip 28 {
}

movieClip 29 {
}

movieClip 31 {
}

movieClip 33 {
}

movieClip 35 {
}

movieClip 37 {
}

movieClip 39 {
}

movieClip 43 {
}

movieClip 45 {
}

movieClip 46 SoundControl {

#initclip
Object.registerClass('SoundControl', logic.EmbedSoundController);
#endinitclip
}

movieClip 48 {
}

movieClip 50 {
}

movieClip 58 {
}

movieClip 60 {
}

movieClip 64 {
}

movieClip 65 {
}

movieClip 66 {
}

movieClip 68 {
}

movieClip 71 {
}

movieClip 73 {
}

movieClip 75 {
}

movieClip 76 {
}

movieClip 79 {

frame 1 {
stop();
normal = function () {
gotoAndStop(1);
};

highLight = function () {
gotoAndStop(2);
};

}
}

movieClip 81 {
}

movieClip 83 {
}

movieClip 85 ControlBlock {

#initclip
Object.registerClass('ControlBlock', logic.EmbedMovieController);
#endinitclip

frame 1 {
sound_control.movie = movie;
trace('controller movie is:' + movie);
}
}

movieClip 86 overlay_screen {

#initclip
Object.registerClass('overlay_screen', logic.Overlay);
#endinitclip
}

movieClip 89 {
}

movieClip 91 {
}

movieClip 93 {
}

movieClip 95 {
}

movieClip 97 {
}

movieClip 98 {
}

movieClip 99 {
}

movieClip 103 {
}

movieClip 105 {
}

movieClip 107 {
}

movieClip 108 endScreen {

#initclip
Object.registerClass('endScreen', logic.EndScreen);
#endinitclip
}

movieClip 110 OverLay {

#initclip
Object.registerClass('OverLay', logic.Overlay);
#endinitclip
}

movieClip 112 fullDisplay {

#initclip
Object.registerClass('fullDisplay', logic.Movie);
#endinitclip
}

movieClip 114 {
}

movieClip 116 {
}

movieClip 118 {
}

movieClip 121 tube {

#initclip
Object.registerClass('tube', logic.EmbedController);
#endinitclip

frame 1 {
controller.registerMovie(movie);
share = controller.share;
share.onRelease = function () {
movie.share();
};

}
}

frame 1 {
tube.movie.static_share = sshare;
if (loop) {
tube.movie.onEndMovie = function () {
this.playMovie();
return true;
};

}
Stage.scaleMode = 'noScale';
Stage.addListener(this);
onResize = function () {
trace(' sw:' + Stage.width + ' sh:' + Stage.height + ' rw:' + _root._width + ' rh:' + _root._height);
tube.resize(Stage.width, Stage.height);
trace('px:' + player._x + ' py:' + player._y);
};

onEnterFrame = function () {
onResize();
delete this.onEnterFrame;
};

tube.setMovie(video_id, iurl, movie_url, l, t, eurl);
if (autoplay) {
tube.playMovie();
}
}

movieClip 122 __Packages.logic.EmbedMovieController {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.EmbedMovieController) {
var v1 = function () {
super();
trace('constructing MovieController:' + this.movie);
trace('timer.seek_total_time' + this.timer.seek_total_time);
this.pause_button._visible = false;
this.fullBar = this.full_progress_bar.fullBar;
this.seekBar = this.full_progress_bar.seekBar;
this.progressBar = this.full_progress_bar.progressBar;
this.seek_time = this.timer.seek_time;
var o = this;
this.play_button.onRelease = function () {
o.movie.playMovie();
};

this.pause_button.onRelease = function () {
o.movie.pauseMovie();
};

this.stop_button.onRelease = function () {
o.movie.stopMovie();
};

var v6 = function () {
o.slider_down = true;
o.slider.highLight();
this.onEnterFrame = function () {
var v1 = o._xmouse;
if (v1 < o.full_progress_bar._x) {
v1 = o.full_progress_bar._x;
} else {
if (v1 > o.full_progress_bar._x + o.full_progress_bar._width) {
v1 = o.full_progress_bar._x + o.full_progress_bar._width;
}
}
o.slider._x = v1;
o.movie.peekSeekRatio(o.getScale());
};

};

var v7 = function () {
o.slider.normal();
o.movie.setSeekRatio(o.getScale());
o.slider_down = false;
delete this.onEnterFrame;
};

this.slider.onPress = v6;
this.full_progress_bar.onPress = this.slider.onPress;
this.slider.onReleaseOutside = v7;
this.slider.onRelease = this.slider.onReleaseOutside;
this.full_progress_bar.onReleaseOutside = this.slider.onReleaseOutside;
this.full_progress_bar.onRelease = this.slider.onReleaseOutside;
var v3 = this.getBounds(this);
this.left_justified_elements = [this.play_button, this.pause_button, this.ldiv, this.full_progress_bar, this.bg];
for (var v5 in this.left_justified_elements) {
this.left_justified_elements[v5]._xstart = v3.xMin - this.left_justified_elements[v5]._x;
}
this.bg._width_offset = this._width - this.bg._width;
this.right_justified_elements = [this.timer, this.sound_control, this.mrdiv, this.rdiv, this.share];
for (v5 in this.right_justified_elements) {
this.right_justified_elements[v5]._xstart = v3.xMax - this.right_justified_elements[v5]._x;
}
trace('regular:' + this.regular + ' smal._xstart:' + this.regular._xstart);
this.full_progress_bar._xend = v3.xMax - (this.full_progress_bar._width + this.full_progress_bar._x);
};

logic.EmbedMovieController = v1;
logic.EmbedMovieController extends MovieClip;
var v2 = v1.prototype;
v2.registerMovie = function (m) {
trace('registering controller to:' + m);
this.movie = m;
this.sound_control.registerMovie(m);
this.showSeek(0, 0);
this.showProgress(0, 0);
var o = this;
m.onPauseMovie = function () {
trace('showing the goddamn play button');
o.showPlay();
};

var old_handler = m.onPlayMovie;
m.onPlayMovie = function () {
o.showPause();
old_handler();
};

m.onSeek = function (ir, r) {
o.showSeek(ir, r);
};

m.onProgress = function (ir, r) {
o.showProgress(ir, r);
};

};

v2.getScale = function () {
var v2 = (this.slider._x - this.full_progress_bar._x) / this.full_progress_bar._width;
if (v2 < 0) {
return 0;
} else {
return v2;
}
};

v2.resize_width = function (w) {
trace('resize width:' + w + ' bg offset' + this.bg._width_offset);
this.bg._width = w - this.bg._width_offset;
for (var v2 in this.left_justified_elements) {
this.left_justified_elements[v2]._x = -1 * (w / 2) - this.left_justified_elements[v2]._xstart;
}
this.sound_control.enablePopUp();
this.slider._x = this.full_progress_bar._x;
var v5 = this.full_progress_bar._x + logic.EmbedMovieController.MIN_PROGRESS_BAR_SIZE;
var v3;
v2 = 0;
while (v2 < this.right_justified_elements.length) {
this.right_justified_elements[v2]._x = w / 2 - this.right_justified_elements[v2]._xstart;
if (this.right_justified_elements[v2]._x < this.rdiv._x) {
if (this.right_justified_elements[v2]._x - 10 < v5) {
this.right_justified_elements[v2]._visible = false;
} else {
this.right_justified_elements[v2]._visible = true;
if (isNaN(v3)) {
v3 = this.right_justified_elements[v2]._x;
}
}
} else {
if (isNaN(v3)) {
v3 = this.right_justified_elements[v2]._x;
}
}
++v2;
}
this.full_progress_bar._width = v3 - this.full_progress_bar._x - 12;
};

v2.showPlay = function () {
this.play_button._visible = true;
this.pause_button._visible = false;
};

v2.showPause = function () {
this.play_button._visible = false;
this.pause_button._visible = true;
};

v2.format_minute_time = function (t) {
if (isNaN(t) || t < 0) {
return '--:--';
}
var v1 = String(Math.floor(t % 60));
if (v1.length == 1) {
v1 = '0' + v1;
}
var v2 = String(Math.floor(t / 60));
if (v2.length == 1) {
v2 = '0' + v2;
}
return v2 + ':' + v1;
};

v2.showSeek = function (ir, r) {
var v2 = this.movie.getCurrentTime();
if (isNaN(v2)) {
v2 = 0;
}
this.seek_time.text = this.format_minute_time(this.movie.getTotalTime() - v2);
this.seek_total_time.text = this.format_minute_time(this.movie.getTotalTime());
this.seekBar._x = ir * this.fullBar._width;
this.seekBar._width = (r - ir) * this.fullBar._width;
if (!this.slider_down) {
this.slider._x = r * this.full_progress_bar._width + this.full_progress_bar._x;
}
};

v2.showProgress = function (ir, r) {
this.progressBar._x = ir * this.fullBar._width;
this.progressBar._width = (r - ir) * this.fullBar._width;
};

v2.showFSButtons = function (_show) {
var o = this;
if (_show) {
this.min._visible = true;
this.max._visible = false;
this.regular._visible = false;
this.small._visible = false;
} else {
this.min._visible = false;
this.max._visible = true;
this.regular._visible = false;
this.small._visible = true;
this.regular.onPress = function () {
trace('to: regular');
o.movie.resizeNormal();
o.regular._visible = false;
o.small._visible = true;
};

this.small.onRelease = function () {
trace('to: original');
o.movie.resizeOriginal();
o.regular._visible = true;
o.small._visible = false;
};

}
};

v2.slider_down = false;
v1.MIN_PROGRESS_BAR_SIZE = 50;
ASSetPropFlags(logic.EmbedMovieController.prototype, null, 1);
}
#endinitclip
}

movieClip 123 __Packages.logic.Overlay {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.Overlay) {
var v1 = function () {
super();
this.loading._visible = false;
this.loading._woffset = this._width - this.loading._width;
};

logic.Overlay = v1;
logic.Overlay extends MovieClip;
var v2 = v1.prototype;
v2.show_message = function (msg) {
this.loading.text = msg;
};

v2.show_loading = function () {
this.loading._visible = true;
};

v2.hide = function () {
this.loading._visible = false;
this._alpha = 0;
};

v2.show = function () {
this.loading._visible = false;
this._alpha = 100;
};

v2.resize = function (w, h) {
this.bg._width = w;
this.bg._height = h;
this.loading._width = w - this.loading._woffset;
if (this.loading._xscale > 100) {
this.loading._xscale = 100;
}
this.loading._yscale = this.loading._xscale;
this.loading._x = -1 * this.loading._width / 2;
this.fit_img();
};

v2.fit_img = function () {
if (this.img._loaded) {
this.img._width = this.bg._width;
this.img._height = this.bg._height;
this.img._x = -1 * this.bg._width / 2;
this.img._y = -1 * this.bg._height / 2;
trace('fiting image to:' + this.bg._width + ':' + this.bg._height + ' actual:' + this.img._width + ':' + this.img._height);
}
};

v2.gotoURL = function () {
};

v2.makePressable = function () {
this.onRelease = this.gotoURL;
};

v2.makePlayPressable = function () {
this.onRelease = function () {
};

};

v2.loadClip = function (still_url) {
var v2 = new Object();
var o = this;
if (!still_url || still_url.indexOf('http://') != 0) {
return undefined;
}
v2.onLoadInit = function (target_mc) {
target_mc._loaded = true;
o.fit_img();
trace('we loaded the image');
};

var v3 = new MovieClipLoader();
v3.addListener(v2);
this.createEmptyMovieClip('img', this.loading.getDepth() - 1);
v3.loadClip(still_url, this.img);
};

ASSetPropFlags(logic.Overlay.prototype, null, 1);
}
#endinitclip
}

movieClip 124 __Packages.logic.EndScreen {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.EndScreen) {
var v1 = function () {
super();
this.movie = this._parent;
this.share = this.end_buttons.share;
this.replay = this.end_buttons.replay;
trace('Ending the movie is :' + this.movie);
var o = this;
this.replay.onPress = function () {
trace('replay me please:' + o.movie);
if (o.movie.rePlay) {
o.movie.rePlay();
} else {
o.movie.playMovie();
}
};

this.share.onRelease = function () {
o.movie.share();
};

this.prev_button.onRelease = function () {
o.load_previous_panels();
};

this.init();
};

logic.EndScreen = v1;
logic.EndScreen extends MovieClip;
var v2 = v1.prototype;
v2.init = function () {
this.end_buttons._visible = true;
this.next_panel._visible = false;
this.count_down._visible = false;
this.prev_button._visible = false;
this.next_visible = false;
};

v2.show = function () {
if (!this._visible) {
this._visible = true;
this.init();
this.display_next();
}
};

v2.hide = function () {
this._visible = false;
this.count_down.reset();
};

v2.resize = function (w, h) {
this.bg._width = w;
this.bg._height = h;
this.end_buttons._width = w - 20;
if (this.end_buttons._xscale > 100) {
this.end_buttons._xscale = 100;
}
this.end_buttons._yscale = this.end_buttons._xscale;
this.layout_next();
};

v2.load_for_awsome = function () {
var v2 = new logic.urlRestXML(this.movie.base_url);
this.next_visible = false;
v2.dispatch(this, this.parse_next, undefined, 'set_awesome', {'video_id': this.movie.video_id, 'w': this.movie.getSeekRatio(), 'l': this.movie.getTotalTime(), 'm': ''});
};

v2.show_next = function () {
this.next_visible = true;
this._visible = true;
this.end_buttons._visible = false;
var v3 = new logic.urlRestXML(this.movie.base_url);
v3.dispatch(this, this.parse_next, undefined, 'next_awesome', {'video_id': this.movie.video_id, 'w': this.movie.getSeekRatio(), 'l': this.movie.getTotalTime(), 'nc': _root.nc});
};

v2.parse_next = function (data) {
_root.status.text = 'data receieved';
this.awsome_data = data;
if (this._visible) {
this.display_next();
}
};

v2.parse_data = function () {
if (this.awsome_data) {
var v4 = logic.restXML.get_sub_array('video', this.awsome_data.video_list);
this.awsome_videos = [];
var v3 = 0;
while (v3 < v4.length) {
this.awsome_videos.push(logic.restXML.get_dict(v4[v3]));
++v3;
}
this.awsome_data = undefined;
_root.status.text = 'Data parsed :' + this.awsome_videos.length;
}
};

v2.display_next = function () {
if (!this.movie.supress_next) {
if (this.next_visible) {
this.end_buttons._visible = false;
}
if (this.awsome_data) {
this.parse_data();
}
this.layout_next();
}
};

v2.layout_next = function () {
if (!this.next_panel) {
return undefined;
}
var v7 = this.bg.getBounds(this);
var v10 = v7.yMin;
var v9 = v7.yMax - v7.yMin;
var v8 = 0;
if (this.end_buttons._visible == true) {
v8 = this.end_buttons._height + 2 * this.margin;
}
var v5 = Math.max(0, Math.min(int((v9 - v8) / (this.next_panel._height + this.margin)), 4));
trace('panels:' + v5);
var v6 = v7.yMin + (v9 - (v8 + this.next_panel._height * v5 + this.margin * Math.max(v5 - 1, 0))) / 2;
if (this.end_buttons._visible == true) {
this.end_buttons._y = v6 + this.end_buttons._height / 2;
v6 += this.end_buttons._height + 2 * this.margin;
}
trace('top_margin:' + v6 + ' height:' + v9 + ' panel:' + this.next_panel._height + 'margin:' + this.margin);
this.panels = [];
var v3 = 0;
while (v3 < v5) {
var v2;
if (v3 == 0) {
v2 = this.next_panel;
} else {
trace('creating next clip');
v2 = this.attachMovie('NextVideoPanel', 'next_panel' + v3, v3);
}
v2._x = this.next_panel._x;
v2._y = v6 + v2._height / 2;
v6 += v2._height + this.margin;
v2.load(this.get_next());
this.panels.push(v2);
++v3;
}
var v4 = v5;
while (v4 < this.last_panels) {
if (v4 != 0) {
this['next_panel' + v4].removeMovieClip();
trace('removing panels');
}
++v4;
}
this.last_panels = v5;
this.count_down._x = v7.xMax - (this.margin / 2 + this.count_down._width / 2);
this.count_down._y = v7.yMax - (this.margin / 2 + this.count_down._height / 2);
this.count_down.reset();
this.count_down._visible = false;
this.prev_button._x = v7.xMin + this.margin / 2 + this.prev_button._width / 2;
this.prev_button._y = v7.yMax - (this.margin / 2 + this.prev_button._height / 2);
this.prev_button._visible = false;
};

v2.get_next = function () {
if (isNaN(this.next_index)) {
this.next_index = 0;
return this.awsome_videos[this.next_index];
}
this.next_index = (this.next_index + 1) % this.awsome_videos.length;
return this.awsome_videos[this.next_index];
};

v2.clip_loaded = function () {
var v2 = 0;
while (v2 < this.panels.length) {
if (!this.panels[v2].loaded) {
trace(this.panels[v2] + 'not loaded');
return undefined;
}
++v2;
}
this.count_down._visible = true;
this.prev_button._visible = true;
trace('STARTING COUNT DOWN!');
this.count_down.start_count_down(1, this);
};

v2.count_down_end = function () {
trace('STARTING COUNT END!');
var v2 = 0;
while (v2 < this.panels.length) {
this.panels[v2].load(this.get_next());
++v2;
}
this.count_down._visible = false;
this.prev_button._visible = false;
};

v2.load_previous_panels = function () {
if (this.count_down.is_counting()) {
this.next_index -= 2 * this.panels.length;
if (this.next_index < 0) {
this.next_index += this.awsome_videos.length;
}
}
this.count_down.end_count();
};

v2.pause = function () {
this.count_down.pause();
};

v2.unpause = function () {
this.count_down.unpause();
};

v2.panels = [];
v2.last_panels = 0;
v2.margin = 11;
ASSetPropFlags(logic.EndScreen.prototype, null, 1);
}
#endinitclip
}

movieClip 125 __Packages.logic.restXML {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.restXML) {
var v1 = function (_req_url) {
this.request_url = _req_url;
trace('initializing:' + _req_url);
};

logic.restXML = v1;
var v2 = v1.prototype;
v2.get_call_string = function (method) {
return 'api2_rest?method=' + escape(method);
};

v2.dispatch = function (o, cb, cb_error, method, params) {
var v7 = new XML();
var v8 = new XML();
v8.ignoreWhite = false;
v7.ignoreWhite = true;
if (_root.auth_code != undefined) {
trace('auth code:' + _root.auth_code);
v8.addRequestHeader('Authorization', _root.auth_code);
}
var v3 = this.get_call_string(method);
for (var v5 in params) {
if (v3.indexOf('?') == -1) {
v3 += '?';
} else {
v3 += '&';
}
v3 += v5 + '=';
v3 += escape(params[v5]);
}
var v9 = this.request_url + v3;
trace('request_url' + this.request_url);
var pr = this;
v7.onLoad = function (success) {
if (success) {
trace('result xml:' + this);
var v2 = pr.process(this);
if (v2.error) {
cb_error.call(o, v2.data);
} else {
cb.call(o, v2.data);
}
} else {
cb_error.call(o);
}
};

trace('sending request to:' + v9);
v8.sendAndLoad(v9, v7);
};

v2.process = function (xml_rsp) {
var v1 = {};
var v2 = logic.restXML.get_sub_node('ut_response', xml_rsp);
if (v2.attributes.status == 'ok') {
v1.data = logic.restXML.get_dict(v2);
return v1;
}
if (v2.attributes.status == 'fail') {
var v3 = logic.restXML.get_dict(v2);
v1.data = logic.restXML.get_dict(v3.error);
v1.error = true;
return v1;
}
v1.error = true;
return v1;
};

v1.get_dict = function (node) {
trace('node is:' + node.childNodes + ' length:' + node.childNodes.length);
if (!node) {
return undefined;
}
var v5 = new Object();
var v2 = 0;
while (v2 < node.childNodes.length) {
var v1 = node.childNodes[v2];
if (v1.nodeType == 1) {
var v3 = v1.childNodes[0];
if (v3.nodeType == 3) {
v5[v1.nodeName] = v3.nodeValue;
} else {
v5[v1.nodeName] = v1;
}
}
++v2;
}
return v5;
};

v1.get_sub_array = function (name, node) {
if (!node) {
return undefined;
}
var v4 = [];
var v1 = 0;
while (v1 < node.childNodes.length) {
var v2 = node.childNodes[v1];
if (v2.nodeName == name) {
v4.push(v2);
}
++v1;
}
return v4;
};

v1.get_sub_node = function (name, node) {
var v2 = node.childNodes;
for (var v4 in v2) {
node = v2[v4];
if (node.nodeType == 1 and node.nodeName == name) {
return node;
}
}
};

v1.get_sub_text = function (name, node) {
node = logic.restXML.get_sub_node(name, node);
var v2 = node.childNodes;
for (var v3 in v2) {
node = v2[v3];
if (node.nodeType == 3) {
return logic.restXML.strip_white_space(node.nodeValue);
}
}
};

v1.add_text_node = function (name, value, node) {
var v2 = new XML();
var v1 = v2.createElement(name);
v1.appendChild(v2.createTextNode(value));
node.appendChild(v1);
};

v1.is_whitespace = function (c) {
return c == ' ' || c == '\n' || c == '\t';
};

v1.strip_white_space = function (buffer) {
var v4 = 0;
var v3 = buffer.length - 1;
var v1 = 0;
while (v1 < buffer.length) {
if (v4 == v1 && logic.restXML.is_whitespace(buffer.charAt(v4))) {
++v4;
}
if (v3 == buffer.length - (v1 + 1) && logic.restXML.is_whitespace(buffer.charAt(v3))) {
--v3;
}
if (v4 == v1 + 1 || v3 == buffer.length - (v1 + 2)) {
} else {
break;
}
++v1;
}
return buffer.slice(v4, v3 + 1);
};

ASSetPropFlags(logic.restXML.prototype, null, 1);
}
#endinitclip
}

movieClip 126 __Packages.logic.urlRestXML {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.urlRestXML) {
var v1 = function (r) {
super(r);
};

logic.urlRestXML = v1;
logic.urlRestXML extends logic.restXML;
var v2 = v1.prototype;
v2.get_call_string = function (method) {
return method;
};

ASSetPropFlags(logic.urlRestXML.prototype, null, 1);
}
#endinitclip
}

movieClip 127 __Packages.logic.Movie {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.Movie) {
var v1 = function () {
super();
trace('Constructing movie');
this.videoDisplay.smoothing = true;
this.snd = this.createEmptyMovieClip('snd', 0);
this.sound_data_so = SharedObject.getLocal('soundData', '/');
this.sound_data = this.sound_data_so.data;
this.audio = new Sound(this.snd);
if (this.sound_data.volume == undefined) {
this.sound_data.volume = 100;
}
if (this.sound_data.mute == undefined) {
this.sound_data.mute = false;
}
if (_root.BASE_YT_URL == undefined) {
this.base_url = 'http://www.youtube.com/';
} else {
this.base_url = _root.BASE_YT_URL;
}
this.display_ratio = this.videoDisplay._width / this.videoDisplay._height;
this.registerLoader(new logic.MovieLoader());
this.end_screen._visible = false;
};

logic.Movie = v1;
logic.Movie extends MovieClip;
var v2 = v1.prototype;
v2.initController = function () {
if (this.sound_data.mute) {
this.audio.setVolume(0);
this.onShowMute();
} else {
this.onShowVolume(this.sound_data.volume);
this.audio.setVolume(this.sound_data.volume);
}
if (this.is_playing) {
this.onPlayMovie();
} else {
this.onPauseMovie();
}
};

v2.setMovie = function (_video_id, image_url, movie_url, l, _track_id, eurl, append_vars) {
trace('setting the movie video_id:' + _video_id + ' base_url:' + this.base_url);
this.video_id = _video_id;
this.track_id = _track_id;
var v2 = image_url;
if (v2 == undefined && this.is_embed) {
v2 = 'http://static.youtube.com/get_still.php?video_id=' + this.video_id;
}
if (eurl == undefined) {
eurl = '';
}
if (append_vars == undefined) {
append_vars = '';
}
if (movie_url == undefined) {
movie_url = this.base_url + 'watch?v=' + this.video_id + '&eurl=' + escape(eurl);
}
this.movie_url = movie_url;
this.movieTime = l;
this.cues = undefined;
if (this.is_embed) {
append_vars += '&eurl=' + escape(eurl);
if (this.is_ad) {
append_vars += '&adp=1';
}
this.load_awsome = false;
} else {
this.load_awsome = true;
}
if (this.tracker_cls) {
this.tracker = new this.tracker_cls(this);
} else {
this.tracker = undefined;
}
this.setSeek(0);
this.pauseMovie();
this.hideEnded();
this.is_playing = false;
this.started = false;
this.restart = false;
this.start_time = 0;
this.start_bytes = 0;
this.stall_count = 0;
this.api_loaded = false;
this.max_seek_ratio = 0;
if (this.is_embed) {
if (this.is_ad) {
this.overlay.makePlayPressable();
} else {
this.overlay.makePressable();
}
this.overlay.loadClip(v2);
}
this.loader.load(this.base_url, this.video_id, this.track_id, append_vars);
if (!this.loader.started) {
this.overlay.show();
} else {
this.overlay.hide();
}
};

v2.registerLoader = function (_loader) {
if (this.loader) {
this.loader.die();
delete this.ns;
delete this.loader;
}
this.loader = _loader;
this.loader.setMovie(this);
this.ns = this.loader.ns;
this.videoDisplay.attachVideo(this.ns);
this.snd.attachAudio(this.ns);
};

v2.popLoader = function () {
var v2 = this.loader;
delete this.ns;
delete this.loader;
this.registerLoader(new logic.MovieLoader());
return v2;
};

v2.share = function () {
if (this.static_share_clip) {
this.static_share_clip.removeMovieClip();
delete this.static_share_clip;
} else {
if (this.static_share) {
this._parent.play_button._visible = false;
this.attachMovie('StaticShare', 'static_share_clip', this.getNextHighestDepth(), {'share_url': this.movie_url});
} else {
logic.Util.popUpShare(this.base_url, this.video_id);
}
}
this.pauseMovie();
};

v2.endMovie = function () {
this.restart = true;
this.pauseMovie();
if (this.load_awsome) {
this.end_screen.load_for_awsome();
this.load_awsome = false;
}
if (this.tracker) {
this.tracker.doTrack(this.getTime(), this.getSeekRatio());
}
if (!this.onEndMovie()) {
this.showEnded();
}
};

v2.showEnded = function () {
this.end_screen.show();
};

v2.hideEnded = function () {
this.end_screen.hide();
};

v2.pauseMovie = function () {
this.ns.pause(true);
this.is_playing = false;
this.onPauseMovie();
};

v2.stopMovie = function () {
this.restart = true;
this.pauseMovie();
this.setSeek(0);
};

v2.stopAll = function () {
this.is_playing = false;
this.loader.die();
this.pauseMovie();
};

v2.playMovie = function () {
if (this.static_share_clip) {
this.static_share_clip.removeMovieClip();
delete this.static_share_clip;
}
if (this.loader.started == false) {
trace('play movie:' + this.file);
trace('ns:' + this.ns + ', ns.stats:' + this.ns.onStatus);
this.loader.start();
this.overlay.show_loading();
this.onStartMovie();
} else {
if (this.restart == true) {
this.setSeek(0);
}
this.ns.pause(false);
}
this.restart = false;
this.hideEnded();
this.is_playing = true;
this.onPlayMovie();
};

v2.isPlaying = function () {
return this.is_playing;
};

v2.getMovieInfo = function () {
trace('getting movie');
var v2 = new logic.restXML(this.base_url);
trace(v2);
v2.dispatch(this, this.parseMovieInfo, undefined, 'youtube.videos.get_video_info', {'video_id': this.video_id});
};

v2.parseMovieInfo = function (data) {
trace('the set movie is :' + data);
if (data.video) {
var v2 = logic.restXML.get_dict(data.video);
var v3 = Number(v2.length_seconds);
if (v3) {
this.movieTime = v3;
}
if (v2.embed_status == 'rejected' || v2.embed_status == 'unavail') {
this.overlay.show_message('This video is no longer available.');
this.stopAll();
} else {
if (v2.embed_status == 'not_allowed') {
this.overlay.show_message('The owner of this video does not allow video embedding please watch this video on YouTube.com');
this.stopAll();
}
}
this.api_loaded = true;
}
};

v2.Mute = function () {
this.sound_data.mute = true;
this.audio.setVolume(0);
this.onShowMute();
this.sound_data_so.flush();
};

v2.setInfringeMute = function () {
this.is_infringe_mute = true;
};

v2.unMute = function () {
if (!this.is_infringe_mute) {
this.sound_data.mute = false;
this.audio.setVolume(this.sound_data.volume);
this.onShowVolume(this.sound_data.volume);
this.sound_data_so.flush();
}
};

v2.toggleMute = function () {
if (this.sound_data.mute) {
this.unMute();
} else {
this.Mute();
}
};

v2.setVolume = function (v) {
if (!this.is_infringe_mute) {
this.sound_data.volume = v;
this.sound_data.mute = false;
trace('setting volumne to:' + v + ':' + this.sound_data.volume);
this.audio.setVolume(this.sound_data.volume);
this.onShowVolume(this.sound_data.volume);
this.sound_data_so.flush();
}
};

v2.setSeekRatio = function (ratio) {
this.setSeek(ratio * this.movieTime);
};

v2.getTotalTime = function () {
return this.movieTime;
};

v2.getCurrentTime = function () {
return this.ns.time;
};

v2.findCue = function (t) {
trace('There is no que?');
if (this.cues) {
var v2 = 0;
while (v2 < this.cues.times.length) {
var v3 = v2 + 1;
if (this.cues.times[v2] <= t && (this.cues.times[v3] >= t || v3 + 1 == this.cues.times.length)) {
trace('found que as index:' + v2);
return {'time': this.cues.times[v2], 'position': this.cues.positions[v2]};
}
++v2;
}
}
};

v2.setSeek = function (s) {
if (s != undefined) {
this.ns.seek(s - this.start_time);
this.onSeek(this.getStartRatio(), this.getSeekRatio());
this.ns.pause(!this.is_playing);
}
};

v2.peekSeekRatio = function (r) {
trace('seeking:' + r);
this.hideEnded();
this.restart = false;
this.hideEnded();
this.ns.seek(r * this.movieTime - this.start_time);
this.onSeek(this.getStartRatio(), this.getSeekRatio());
trace('start:' + this.getStartRatio() + ' seeked:' + this.getSeekRatio());
};

v2.getLoadRatio = function () {
var v3 = this.ns.bytesLoaded + this.start_bytes;
var v2 = this.ns.bytesTotal + this.start_bytes;
if (v2 == 0) {
return 0;
} else {
if (v3 == v2 && v3 > 1000) {
return 1;
} else {
return v3 / v2;
}
}
};

v2.getSeekRatio = function () {
if (this.restart == true) {
return 0;
} else {
if (this.start_time + this.ns.time > this.movieTime) {
return 1;
} else {
return (this.start_time + this.ns.time) / this.movieTime;
}
}
};

v2.getStartRatio = function () {
if (this.start_time == undefined) {
return 0;
} else {
if (this.start_time > this.movieTime) {
return 1;
} else {
return this.start_time / this.movieTime;
}
}
};

v2.getTime = function () {
if (this.start_time == undefined) {
return this.ns.time;
} else {
return this.start_time + this.ns.time;
}
};

v2.onEnterFrame = function () {
var v4 = this.getStartRatio();
var v3 = this.getSeekRatio();
var v2 = this.getTime();
this.onSeek(v4, v3);
this.onProgress(v4, this.getLoadRatio());
this.max_seek_ratio = Math.max(this.max_seek_ratio, v3);
if (v3 > 0.8 && this.load_awsome) {
trace('loading for awsome.');
this.end_screen.load_for_awsome();
this.load_awsome = false;
}
if (this.tracker) {
this.tracker.doTrack(v2, v3);
}
if (this.init_run) {
this.initController();
this.init_run = false;
} else {
if (this.ns.bytesLoaded == this.ns.bytesTotal && v2 >= this.movieTime - 1 && this.is_playing) {
if (this.lastTime != v2) {
this.lastTime = v2;
this.stallCount = 0;
} else {
if (this.stallCount < 30) {
++this.stallCount;
} else {
this.endMovie();
this.stallCount = 0;
}
}
}
}
};

v2.resizeNormal = function () {
this.videoDisplay._height = this.overlay._height;
this.videoDisplay._width = this.overlay._width;
this.videoDisplay._x = this.videoDisplay._width / -2;
this.videoDisplay._y = this.videoDisplay._height / -2;
};

v2.resizeOriginal = function () {
this.videoDisplay._height = this.videoDisplay.height;
this.videoDisplay._width = this.videoDisplay.width;
this.videoDisplay._x = this.videoDisplay._width / -2;
this.videoDisplay._y = this.videoDisplay._height / -2;
};

v2.resize = function (w, h) {
var v4 = w / h;
if (v4 > this.display_ratio) {
w = h * this.display_ratio;
} else {
h = w / this.display_ratio;
}
trace('resizing to:' + w + ':' + h + ' ratio:' + this.display_ratio);
this.videoDisplay._width = w;
this.videoDisplay._height = h;
this.videoDisplay._x = -1 * w / 2;
this.videoDisplay._y = -1 * h / 2;
this.bg._width = w;
this.bg._height = h;
this.overlay.resize(w, h);
this.end_screen.resize(w, h);
trace('overlay: ' + this.overlay._width + ',' + this.overlay._height);
trace('end_screen: ' + this.end_screen._width + ',' + this.end_screen._height);
};

v2.init_run = true;
v2.is_embed = false;
v2.is_ad = false;
v2.is_infringe_mute = false;
ASSetPropFlags(logic.Movie.prototype, null, 1);
}
#endinitclip
}

movieClip 128 __Packages.logic.MovieLoader {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.MovieLoader) {
var v1 = function () {
this.started = false;
this.nc = new NetConnection();
this.nc.connect(null);
this.ns = new NetStream(this.nc);
this.ns.setBufferTime(2);
var o = this;
this.ns.onMetaData = function (obj) {
trace('we got meta fuck yeah!');
if (obj.duration != undefined) {
o.movieTime = obj.duration;
trace('time is:' + o.movieTime);
if (obj.keyframes) {
o.cues = {'times': obj.keyframes.times, 'positions': obj.keyframes.filepositions};
trace('cues times are:' + o.cues.times);
}
} else {
o.movieTime == undefined;
o.cues = undefined;
}
};

this.ns.onStatus = function (object) {
trace('status code is:' + object.code);
if (object.code == 'NetStream.Play.Stop') {
trace('movie stoping..');
if (o.movie.is_playing) {
o.movie.endMovie();
}
} else {
if (object.code == 'NetStream.Play.Start') {
o.started = true;
o.movie.overlay.hide();
} else {
if (object.code == 'NetStream.Buffer.Full') {
trace('movie starting to play..');
if (o.movieTime && o.movie.movieTime == undefined) {
o.movie.movieTime = o.movieTime;
} else {
if (o.movie.movieTime == undefined && !o.api_loaded) {
trace('loading for time.');
o.movie.getMovieInfo();
}
}
} else {
if (object.code == 'NetStream.Play.StreamNotFound') {
trace('movie Error..');
if (o.movie.is_embed && !o.movie.api_loaded) {
trace('loading from embed');
o.movie.getMovieInfo();
}
o.loadLater();
}
}
}
}
};

};

logic.MovieLoader = v1;
var v2 = v1.prototype;
v2.loadLater = function () {
if (this.interval_id) {
this.ns.play(this.file + this.append_vars);
this.ns.pause(!this.started);
clearInterval(this.interval_id);
this.interval_id = undefined;
} else {
this.interval_id = setInterval(this, 'loadLater', this.wait_time * 1000);
this.wait_time *= 5;
}
};

v2.load = function (base_url, video_id, track_id, _append_vars) {
var v2 = base_url + 'get_video?video_id=' + video_id + '&t=' + track_id;
if (this.interval_id) {
clearInterval(this.interval_id);
this.interval_id = undefined;
}
if (v2 != this.file) {
this.append_vars = _append_vars;
trace('DIFFERENT loading :' + this.file + ' vs ' + v2);
this.file = v2;
this.movieTime = undefined;
this.wait_time = 5;
this.started = false;
}
};

v2.setMovie = function (m) {
this.movie = m;
};

v2.die = function () {
this.started = false;
this.ns.close();
if (this.interval_id) {
clearInterval(this.interval_id);
}
};

v2.preLoad = function () {
trace('PRELOAD :' + this.file);
this.ns.play(this.file + this.append_vars);
this.ns.pause(true);
};

v2.start = function () {
trace('START PLAYING :' + this.file);
this.ns.play(this.file + this.append_vars);
this.started = true;
};

ASSetPropFlags(logic.MovieLoader.prototype, null, 1);
}
#endinitclip
}

movieClip 129 __Packages.logic.Util {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.Util) {
var v1 = function () {};

logic.Util = v1;
var v2 = v1.prototype;
v1.alert = function (msg) {
getURL('javascript:alert(\'' + escape(msg) + '\');', '');
};

v1.call_js = function (func) {
var v3 = '';
var v2 = 1;
while (v2 < arguments.length) {
v2 = '\'' + arguments[v2] + '\'';
if (v3.length) {
v3 += ',' + v2;
} else {
v3 += v2;
}
++v2;
}
getURL('javascript:' + func + '(' + v3 + ');', '');
};

v1.popUpWin = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL('javascript:var ' + winName + ';if (!' + winName + '||' + winName + '.closed){' + winName + '=window.open(\'' + url + '\', \'' + winName + '\', \'' + 'width=' + w + ', height=' + h + ', toolbar=' + toolbar + ', location=' + location + ', directories=' + directories + ', status=' + status + ', menubar=' + menubar + ', scrollbars=' + scrollbars + ', resizable=' + resizable + '\')}else{' + winName + '.focus();};void(0);', '');
};

v1.popUpShare = function (base_url, video_id) {
getURL(base_url + 'share?v=' + video_id + '&embed=1', '_blank');
};

v1.popUpSharePlayList = function (base_url, pl_id) {
getURL(base_url + 'share?p=' + pl_id + '&embed=1', '_blank');
};

v1.loadImgClip = function (clip, img_url, notifier, _b) {
trace('clip:' + clip + ' getting video for msg:' + img_url);
var v1 = new Object();
var b = _b;
if (!b) {
b = clip.getBounds(clip._parent);
}
var n = notifier;
var v4 = function (target_mc, error) {
target_mc._x = b.xMin;
target_mc._y = b.yMin;
target_mc._width = b.xMax - b.xMin;
target_mc._height = b.yMax - b.yMin;
if (n) {
n.onClipLoaded(target_mc, error);
}
};

v1.onLoadInit = v4;
v1.onLoadError = v4;
var v3 = new MovieClipLoader();
v3.addListener(v1);
v3.loadClip(img_url, clip);
};

ASSetPropFlags(logic.Util.prototype, null, 1);
}
#endinitclip
}

movieClip 130 __Packages.logic.EmbedController {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.EmbedController) {
var v1 = function () {
super();
var o = this;
this.watermark._xoffset = this.movie._x + this.movie._width / 2 - this.watermark._x;
this.watermark._yoffset = this.movie._y + this.movie._height / 2 - this.watermark._y;
this.movie.is_embed = true;
this.movie.tracker_cls = logic.EmbedTracker;
this.movie.onPlayMovie = function () {
trace('playing.. the movie');
o.play_button._visible = false;
o.onPlayMovie();
};

this.play_button.onPress = function () {
o.playMovie();
};

};

logic.EmbedController = v1;
logic.EmbedController extends MovieClip;
var v2 = v1.prototype;
v2.playMovie = function () {
this.movie.playMovie();
};

v2.setMovie = function (video_id, image_url, movie_url, length, track_id, eurl, append) {
trace('setting movie');
this.play_button._visible = true;
this.movie.setMovie(video_id, image_url, movie_url, length, track_id, eurl, append);
};

v2.fixed_resize = function (w, h) {
trace('resizing to:' + w + ':' + h);
this.movie.resize(w, h - 18);
trace('actual size of movie is:' + this.movie._width + ':' + this.movie._height);
this.controller.resize_width(this.movie.videoDisplay._width);
this.controller._y = this.movie._y + this.movie._height / 2;
this.watermark._x = this.movie._x + this.movie._width / 2 - this.watermark._xoffset;
this.watermark._y = this.movie._y + this.movie._height / 2 - this.watermark._yoffset;
trace(' moive_width:' + this.movie._width + ' w:' + w + ' mx:' + this.movie._x);
};

v2.resize = function (w, h) {
if (w < 300 || h < 237) {
this.fixed_resize(300, 237);
this._width = w;
this._height = h;
if (this._xscale > this._yscale) {
this._xscale = this._yscale;
} else {
this._yscale = this._xscale;
}
} else {
this._xscale = 100;
this._yscale = 100;
this.fixed_resize(w, h);
}
};

ASSetPropFlags(logic.EmbedController.prototype, null, 1);
}
#endinitclip
}

movieClip 131 __Packages.logic.EmbedTracker {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.EmbedTracker) {
var v1 = function (_m) {
this.movie = _m;
this.track_point = 0;
this.do_track = false;
};

logic.EmbedTracker = v1;
var v2 = v1.prototype;
v2.doTrack = function (time, percentage) {
if (isNaN(percentage)) {
return undefined;
} else {
if (this.track_point < 1 && time >= 0) {
trace('getting movie');
var v4 = new logic.restXML(this.movie.base_url);
v4.dispatch(this, this.parseTrack, undefined, 'youtube.videos.track_embed_video', {'video_id': this.movie.video_id});
this.track_point = 1;
} else {
if (this.track_point < 2 && time >= 20 && this.do_track) {
trace('point2:' + this.track_point + ' time:' + time);
this.sendTrack(time, percentage);
this.track_point = 2;
} else {
if (this.track_point < 3 && time >= 30 && this.do_track) {
trace('point2:' + this.track_point + ' time:' + time);
this.sendTrack(time, percentage);
this.track_point = 3;
} else {
if (this.track_point < 4 && percentage >= 0.9 && this.do_track) {
trace('point3:' + this.track_point + ' percentage:' + percentage);
this.sendTrack(time, percentage);
this.track_point = 4;
}
}
}
}
}
};

v2.parseTrack = function (data) {
if (data.track_embed == 1) {
this.do_track = true;
this.sendTrack(this.movie.getTime(), this.movie.getSeekRatio());
}
};

v2.sendTrack = function (time, percentage) {
var v2 = new logic.urlRestXML(this.movie.base_url);
v2.dispatch(this, undefined, undefined, 'tracker', {'w': 4, 'i': this.movie.video_id, 'tp': time, 'p': percentage, 't': this.movie.track_id, 'itype': 4});
};

ASSetPropFlags(logic.EmbedTracker.prototype, null, 1);
}
#endinitclip
}

movieClip 132 __Packages.logic.EmbedSoundController {

#initclip
if (!_global.logic) {
_global.logic = new Object();
}
if (!_global.logic.EmbedSoundController) {
var v1 = function () {
super();
trace('constructing EmbedSoundController:' + this._parent.movie);
var o = this;
this.sound_button.onRelease = function () {
o.movie.toggleMute();
};

var v4 = function () {
o.knob.highLight();
o.onEnterFrame = function () {
var v2 = this._ymouse - o.sound_bar._y;
if (v2 < 0) {
v2 = 0;
} else {
if (v2 > o.sound_bar._height) {
v2 = o.sound_bar._height;
}
}
this.hideMute();
this.knob._y = v2 + o.sound_bar._y;
o.movie.setVolume(o.getSoundPos(this.knob._y));
};

};

this.sound_bar.onPress = v4;
this.knob.onPress = v4;
var v6 = function () {
o.knob.normal();
trace('released x:' + o.getSoundPos(this._y));
var v2 = o.getSoundPos(o.knob._y);
o.movie.setVolume(v2);
delete this._parent.onEnterFrame;
};

this.knob.onReleaseOutside = v6;
this.knob.onRelease = this.knob.onReleaseOutside;
this.sound_bar.onReleaseOutside = this.knob.onReleaseOutside;
this.sound_bar.onRelease = this.knob.onReleaseOutside;
this.hideBar();
};

logic.EmbedSoundController = v1;
logic.EmbedSoundController extends MovieClip;
var v2 = v1.prototype;
v2.registerMovie = function (m) {
this.movie = m;
trace('registering sound to:' + this.movie);
var o = this;
m.onShowMute = function () {
o.showMute();
};

m.onShowVolume = function (v) {
o.hideMute();
o.showVolume(v);
};

};

v2.getSoundPos = function (pos) {
var v2 = Math.round((this.sound_bar._height - (pos - this.sound_bar._y)) * 100 / this.sound_bar._height);
v2 = Math.min(v2, 100);
return Math.max(v2, 0);
};

v2.enablePopUp = function () {
var o = this;
var delayed_hide_id;
var v3 = function () {
o.showBar();
clearInterval(delayed_hide_id);
};

var execute_hide = function () {
o.hideBar();
clearInterval(delayed_hide_id);
};

var v2 = function () {
delayed_hide_id = setInterval(execute_hide, 100);
};

this.sound_bar.onRollOver = v3;
this.knob.onRollOver = this.sound_bar.onRollOver;
this.bg.onRollOver = this.sound_bar.onRollOver;
this.sound_button.onRollOver = this.sound_bar.onRollOver;
this.bg.onRollOut = v2;
this.sound_button.onRollOut = this.bg.onRollOut;
};

v2.disablePopUp = function () {
this.sound_button.onRollOver = undefined;
this.sound_button.onRollOut = undefined;
};

v2.hideBar = function () {
this.sound_bar._visible = false;
this.knob._visible = false;
this.bg._visible = false;
};

v2.showBar = function () {
this.sound_bar._visible = true;
this.knob._visible = true;
this.bg._visible = true;
};

v2.showMute = function () {
this.showVolume(0);
trace('showing mute');
};

v2.hideMute = function () {};

v2.showVolume = function (v) {
trace('show v:' + v);
var v3 = this.sound_bar._height - v * this.sound_bar._height / 100 + this.sound_bar._y;
this.knob._y = v3;
this.showBars(v);
};

v2.showBars = function (v) {
var v3 = Math.round(v * this.num_bars / 100);
var v2 = 1;
while (v2 <= this.num_bars) {
if (v2 <= v3) {
this['v' + v2]._visible = true;
} else {
this['v' + v2]._visible = false;
}
++v2;
}
if (v3 == 0) {
this.sound_button._alpha = 50;
} else {
this.sound_button._alpha = 100;
}
};

v2.muted = false;
v2.num_bars = 2;
ASSetPropFlags(logic.EmbedSoundController.prototype, null, 1);
}
#endinitclip
}
}

投稿者 yespamaster : 2007年04月13日 18:06
ライブハウス検索はイエロースパン
コメント
コメントする









名前、アドレスを登録しますか?