
Welcome Guest
|
#1
|
|||
|
|||
|
Slight actionscript forum
Hello,
After having a video player made for my website, I quickly realised that the video was playing a little jaggery. I found out that this was because anti-aliasing was turned off, and the was to enable it was through video smoothing. The videos played through my website are .flv.. and so the regular "video.smoothing = true | false" was said not to work for these type of files. I found a code that should appear to work "By converting the component video player’s data type to a MovieClip, you get around the video player’s access control and can directly access its video object. This way you can then change its smoothing parameter." Code:
MovieClip(FLVPlayer.getVideoPlayer(FLVPlayer.activeVideoPlayerIndex))._video.smoothing = true; Code:
class VidiPlayer extends MovieClip
{
var vid_obj, vid_file, vid_playing, vid_paused, vid_conn, vid_stream, getURL;
function VidiPlayer(new_vid, file)
{
super();
vid_obj = new_vid;
vid_file = file;
vid_playing = false;
vid_paused = false;
vid_conn = new NetConnection();
vid_conn.connect(null);
vid_stream = new NetStream(vid_conn);
vid_stream.setBufferTime(2);
vid_obj.attachVideo(vid_stream);
vid_stream.onStatus = videoEvents;
vid_stream.onMetaData = getDuration;
} // End of the function
function getVidFile()
{
return (vid_file);
} // End of the function
function getLoadedBytes()
{
return (vid_stream.bytesLoaded);
} // End of the function
function getTotalBytes()
{
return (vid_stream.bytesTotal);
} // End of the function
function getTime()
{
return (vid_stream.time);
} // End of the function
function getBufferLength()
{
return (vid_stream.bufferLength);
} // End of the function
function getBufferTime()
{
return (vid_stream.bufferTime);
} // End of the function
function getDuration(info_obj)
{
_root.vid_duration = info_obj.duration;
} // End of the function
function setVideoEvents(which_event, functions)
{
if (which_event == "start")
{
eventStart = functions;
}
else if (which_event == "stop")
{
eventStop = functions;
}
else if (which_event == "empty")
{
eventEmpty = functions;
} // end else if
} // End of the function
function setSeek(new_time)
{
vid_stream.seek(new_time);
} // End of the function
function videoEvents(info_obj)
{
switch (info_obj.code)
{
case "NetStream.Play.Start":
{
break;
}
case "NetStream.Play.Stop":
{
if (_root.video_vd != undefined)
{
if (vid_stream.time >= _root.vid_duration)
{
_root.gotoAndPlay("endvideo");
} // end if
} // end if
break;
}
case "NetStream.Buffer.Empty":
{
break;
}
case "NetStream.Buffer.Full":
{
break;
}
case "NetStream.Play.StreamNotFound":
{
_root.showThumb();
break;
}
} // End of switch
} // End of the function
function streamVid()
{
vid_stream.play(vid_file);
vid_stream.pause();
vid_playing = true;
vid_paused = true;
} // End of the function
function playVid()
{
if (!vid_playing)
{
vid_stream.play(vid_file);
vid_playing = true;
}
else if (vid_paused)
{
vid_stream.pause();
vid_paused = false;
} // end else if
} // End of the function
function pauseVid()
{
if (vid_playing && !vid_paused)
{
vid_stream.pause();
vid_paused = true;
} // end if
} // End of the function
function rewindVid()
{
if (_root.vid_duration != undefined)
{
var _loc3 = _root.vid_duration / 5;
var _loc4;
if (vid_stream.time - _loc3 < 0)
{
_loc4 = 0;
}
else
{
_loc4 = vid_stream.time - _loc3;
} // end else if
vid_stream.seek(_loc4);
} // end if
} // End of the function
function stopVid()
{
vid_stream.seek(0);
this.pauseVid();
} // End of the function
function forwardVid()
{
if (_root.vid_duration != undefined)
{
var _loc4 = _root.vid_duration / 5;
var _loc3;
if (vid_stream.time + _loc4 >= _root.vid_duration)
{
_loc3 = _root.vid_duration;
}
else
{
_loc3 = vid_stream.time + _loc4;
} // end else if
vid_stream.seek(_loc3);
} // end if
} // End of the function
function endVid()
{
vid_stream.close();
_root.autostart = false;
_root.gotoAndPlay("endvideo");
} // End of the function
function eventStart()
{
trace ("start");
} // End of the function
function eventStop()
{
trace ("stop");
} // End of the function
function eventEmpty()
{
trace ("empty");
} // End of the function
} // End of Class |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Flash ActionScript 2.0 Learning Guide | chetan1 | Flash 8 |
0 | 05-12-2008 06:14 AM |
| Flash 9 ActionScript 3.0 Preview Forum | Scottae | ActionScript 3.0 |
0 | 07-26-2006 06:22 PM |
| Advanced ActionScript Forum | FlashMove | FSUG |
10 | 04-12-2004 05:54 PM |
| moved this from actionscript forum | dazpearce | Advanced Flash | 5 | 03-08-2003 11:36 AM |
| JOB OPENING: Flash ActionScript Programmer | barn | Work/Job Opportunities | 0 | 09-10-2001 11:41 PM |





