From: <gre...@us...> - 2007-08-24 03:45:35
|
Revision: 862 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=862&view=rev Author: gregmac45 Date: 2007-08-23 20:45:27 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/FLV Player/FlashVideoPlayer.csproj trunk/plugins/OnlineVideos/Source/FLV Player/MyFlashPlayer.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.cs trunk/plugins/OnlineVideos/Source/OnlineVideos.sln Modified: trunk/plugins/OnlineVideos/Source/FLV Player/FlashVideoPlayer.csproj =================================================================== --- trunk/plugins/OnlineVideos/Source/FLV Player/FlashVideoPlayer.csproj 2007-08-23 15:02:52 UTC (rev 861) +++ trunk/plugins/OnlineVideos/Source/FLV Player/FlashVideoPlayer.csproj 2007-08-24 03:45:27 UTC (rev 862) @@ -28,7 +28,7 @@ </UpgradeBackupLocation> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <OutputPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\ExternalPlayers\</OutputPath> + <OutputPath>..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\ExternalPlayers\</OutputPath> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> <BaseAddress>285212672</BaseAddress> <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> @@ -47,7 +47,7 @@ <ErrorReport>prompt</ErrorReport> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <OutputPath>..\MediaPortal2\xbmc\bin\Debug\plugins\ExternalPlayers\</OutputPath> + <OutputPath>..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\ExternalPlayers\</OutputPath> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> <BaseAddress>285212672</BaseAddress> <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> @@ -70,15 +70,18 @@ <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> <ItemGroup> + <Reference Include="AxInterop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>bin\Debug\AxInterop.ShockwaveFlashObjects.dll</HintPath> + </Reference> <Reference Include="Core"> <HintPath>..\..\..\..\MediaPortal\Core\bin\Release\Core.DLL</HintPath> <SpecificVersion>False</SpecificVersion> <Private>False</Private> </Reference> - <Reference Include="Databases"> - <HintPath>..\..\..\MediaPortal\Databases\bin\Release\Databases.DLL</HintPath> + <Reference Include="Interop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <Private>False</Private> + <HintPath>bin\Debug\Interop.ShockwaveFlashObjects.dll</HintPath> </Reference> <Reference Include="System"> <Name>System</Name> @@ -96,18 +99,10 @@ <Name>System.XML</Name> </Reference> <Reference Include="Utils"> - <HintPath>..\..\..\MediaPortal\Utils\bin\Release\Utils.DLL</HintPath> + <HintPath>..\..\..\..\Mediaportal\Utils\bin\Release\Utils.DLL</HintPath> <SpecificVersion>False</SpecificVersion> <Private>False</Private> </Reference> - <COMReference Include="AxShockwaveFlashObjects"> - <Guid>{D27CDB6B-AE6D-11CF-96B8-444553540000}</Guid> - <VersionMajor>1</VersionMajor> - <VersionMinor>0</VersionMinor> - <Lcid>0</Lcid> - <WrapperTool>aximp</WrapperTool> - <Isolated>False</Isolated> - </COMReference> <COMReference Include="stdole"> <Guid>{00020430-0000-0000-C000-000000000046}</Guid> <VersionMajor>2</VersionMajor> Modified: trunk/plugins/OnlineVideos/Source/FLV Player/MyFlashPlayer.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/FLV Player/MyFlashPlayer.cs 2007-08-23 15:02:52 UTC (rev 861) +++ trunk/plugins/OnlineVideos/Source/FLV Player/MyFlashPlayer.cs 2007-08-24 03:45:27 UTC (rev 862) @@ -10,278 +10,234 @@ namespace MediaPortal.MyFLVPlayer { - public class FlvPlayerPlugin : IExternalPlayer - { - //public static bool _playerIsPaused; - string _currentFile = String.Empty; - //bool _started; - //bool _ended; - bool _notifyPlaying = false; - double _duration; - double _currentPosition; - DateTime _updateTimer; - bool _needUpdate = true; - //private string[] _supportedExtension = new string[5]; + public class FlvPlayerPlugin : IExternalPlayer + { + //public static bool _playerIsPaused; + string _currentFile = String.Empty; + //bool _started; + //bool _ended; + bool _notifyPlaying = false; + double _duration; + double _currentPosition; + DateTime _updateTimer; + bool _needUpdate = true; + //private string[] _supportedExtension = new string[5]; - bool _isFullScreen = false; - int _positionX = 10, _positionY = 10, _videoWidth = 100, _videoHeight = 100; - //protected ILog _log; + bool _isFullScreen = false; + int _positionX = 10, _positionY = 10, _videoWidth = 100, _videoHeight = 100; + //protected ILog _log; - public static FlashControl FlvControl = null; + public static FlashControl FlvControl = null; - public enum PlayState - { - Init, - Playing, - Paused, - Ended - } - PlayState _playState = PlayState.Init; - public FlvPlayerPlugin() - { - //ServiceProvider services = GlobalServiceProvider.Instance; - //_log = services.Get<ILog>(); - } + public enum PlayState + { + Init, + Playing, + Paused, + Ended + } + PlayState _playState = PlayState.Init; + public FlvPlayerPlugin() + { + //ServiceProvider services = GlobalServiceProvider.Instance; + //_log = services.Get<ILog>(); + } - public override string Description() - { - return "Flash Player"; - } + public override string Description() + { + return "Flash Player"; + } - public override string PlayerName - { - get { return "FlvPlayer"; } - } + public override string PlayerName + { + get { return "FlvPlayer"; } + } - public override string AuthorName - { - get { return "Gregmac45"; } - } + public override string AuthorName + { + get { return "Gregmac45"; } + } - public override string VersionNumber - { - get { return "0.1"; } - } + public override string VersionNumber + { + get { return "0.1"; } + } - public override string[] GetAllSupportedExtensions() + public override string[] GetAllSupportedExtensions() + { + String[] laSupported = new String[1]; + laSupported[0] = ".flv"; + return laSupported; + } + /* + public string[] GetAllSupportedStreams() { - String[] laSupported = new String[1]; - laSupported[0] = ".flv"; + String[] laSupported = new String[2]; + laSupported[0] = "http"; + laSupported[0] = "RTMP"; return laSupported; + } + */ + public override bool SupportsFile(string filename) + { + string ext = null; + int dot = filename.LastIndexOf("."); // couldn't find the dot to get the extension + if (dot == -1) return false; - public override bool SupportsFile(string filename) - { - string ext = null; - int dot = filename.LastIndexOf("."); // couldn't find the dot to get the extension - if (dot == -1) return false; + ext = filename.Substring(dot).Trim(); + if (ext.Length == 0) return false; // no extension so return false; - ext = filename.Substring(dot).Trim(); - if (ext.Length == 0) return false; // no extension so return false; + ext = ext.ToLower(); + if (".flv".Equals(ext)) { return true; }; + return false; + } - ext = ext.ToLower(); - if (".flv".Equals(ext)) { return true; }; - return false; - } + public override bool Play(string strFile) + { + Log.Info("Playing flv with FlvPlayer"); + try + { + FlvControl = new FlashControl(); + FlvControl.Player.FlashCall += new _IShockwaveFlashEvents_FlashCallEventHandler(OnFlashCall); + FlvControl.Player.LoadMovie(0, System.IO.Directory.GetCurrentDirectory()+"\\player.swf"); + + //FlvControl.Player.Movie = System.IO.Directory.GetCurrentDirectory()+"\\player.swf"; + FlvControl.Player.FlashVars = String.Format("&file={0}&autostart=true&enablejs=true&backcolor=0x000000&frontcolor=0xCCCCCC&showicons=false&showvolume=false&showdigits=false&displayheight={1}&allowfullscreen=true",strFile.Replace("&","%26"),9999); + - public override bool Play(string strFile) - { - try - { - //if (FlvControl == null) - //{ - // FlvControl.Player.u - //} - FlvControl = new FlashControl(); - //FlvControl.Player.BackgroundColor = ; - FlvControl.Player.OnReadyStateChange += new _IShockwaveFlashEvents_OnReadyStateChangeEventHandler(OnReady); - FlvControl.Player.FlashCall += new _IShockwaveFlashEvents_FlashCallEventHandler(OnFlashCall); - //FlvControl.Player.LoadMovie(0, @"C:\Dev\FlashExternalAPI\player.swf"); - //Log.Info("player path:{0}", System.IO.Directory.GetCurrentDirectory() + "\\player.swf"); - FlvControl.Player.LoadMovie(0, System.IO.Directory.GetCurrentDirectory()+"\\player.swf"); - - GUIGraphicsContext.form.Controls.Add(FlvControl); - GUIWindowManager.OnNewAction +=new OnActionHandler(OnAction2); - //} - FlvControl.Player.CallFunction("<invoke name=\"loadAndPlayVideo\" returntype=\"xml\"><arguments><string>"+strFile+"</string></arguments></invoke>"); - - //FlvControl.Player.FSCommand += new _IShockwaveFlashEvents_FSCommandEventHandler(OnFSCommand); - //FlvControl.Player.OnProgress += new _IShockwaveFlashEvents_OnProgressEventHandler(OnProgress); - //FlvControl.Player.Play(); + GUIGraphicsContext.form.Controls.Add(FlvControl); + GUIWindowManager.OnNewAction +=new OnActionHandler(OnAction2); + + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); + msg.Label = strFile; + GUIWindowManager.SendThreadMessage(msg); + _notifyPlaying = true; + FlvControl.ClientSize = new Size(0, 0); + FlvControl.Visible = true; + FlvControl.Enabled = true; + _needUpdate = true; + _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; + _positionX = GUIGraphicsContext.VideoWindow.Left; + _positionY = GUIGraphicsContext.VideoWindow.Top; + _videoWidth = GUIGraphicsContext.VideoWindow.Width; + _videoHeight = GUIGraphicsContext.VideoWindow.Height; - //} + _currentFile = strFile; + _duration = -1; + _currentPosition = -1; + _playState = PlayState.Playing; + _updateTimer = DateTime.Now; + SetVideoWindow(); + return true; + } + catch (Exception) + { + } + return false; + } - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); - msg.Label = strFile; - GUIWindowManager.SendThreadMessage(msg); + public void OnFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent foEvent) + { + //Log.Info("OnFlashCall reached with value request:{0},Object:{1}", foEvent.request, sender); + XmlDocument document = new XmlDocument(); + document.LoadXml(foEvent.request); - + // Get all the arguments + XmlNodeList list = document.GetElementsByTagName("invoke"); + String lsName = list[0].Attributes["name"].Value; + list = document.GetElementsByTagName("arguments"); + String lsState = list[0].FirstChild.InnerText; + if (lsName.Equals("getUpdate")) + { + switch (lsState) + { + case "state": + switch(list[0].ChildNodes[1].InnerText){ + case "0": + case "1": + if(_playState == PlayState.Playing){ + _playState = PlayState.Paused; + } + else { + _playState = PlayState.Init; + } + break; + case "2": + _playState = PlayState.Playing; + break; + case "3": + _playState = PlayState.Ended; + break; + } + + + break; + case "time": + _currentPosition = Convert.ToInt32(list[0].ChildNodes[1].InnerText); + _duration = _currentPosition+ Convert.ToInt32(list[0].ChildNodes[2].InnerText); + + break; + + } + } + } + public override bool CanSeek() + { + return true; + } + public void OnAction2(Action foAction) + { + //Log.Info("received action:"+foAction.wID); + //if (foAction.wID == Action.ActionType.ACTION_SHOW_GUI || foAction.wID == Action.ActionType.ACTION_SHOW_FULLSCREEN) + //{ + + //SetVideoWindow(); + //} + } + public override double Duration + { + get + { + return _duration; + } + } - - //_started = false; - //_ended = false; - _notifyPlaying = true; + public override double CurrentPosition + { + get + { + if (FlvControl == null) return 0.0d; + //UpdateStatus(); + //if (_started == false) return 0; + try + { + + + _updateTimer = DateTime.Now; + //return _currentPosition; + //Log.Info("Flash Player - current time {0}", _currentPosition); + + //} + } + catch (Exception e) + { + //_log.Error(e); + Log.Error(e); + } + try + { + return _currentPosition; + } + catch (Exception) + { + FlvControl = null; + return 0.0d; + } + } - - //FlvControl.Visible = true; - //FlvControl.Enabled = true; - FlvControl.ClientSize = new Size(0, 0); - FlvControl.Visible = true; - FlvControl.Enabled = true; - //GUIGraphicsContext.form.Focus(); - - _needUpdate = true; - _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; - _positionX = GUIGraphicsContext.VideoWindow.Left; - _positionY = GUIGraphicsContext.VideoWindow.Top; - _videoWidth = GUIGraphicsContext.VideoWindow.Width; - _videoHeight = GUIGraphicsContext.VideoWindow.Height; - - //_started = true; - //SetWindows(); - - //_playerIsPaused = false; - _currentFile = strFile; - _duration = -1; - _currentPosition = -1; - _playState = PlayState.Playing; - _updateTimer = DateTime.Now; - SetVideoWindow(); - return true; - } - catch (Exception) - { - } - return false; - } - - public void OnReady(object sender,_IShockwaveFlashEvents_OnReadyStateChangeEvent foEvent) - { - /* - - Log.Info("OnReady2 reached with value {0}", foEvent.newState); - if (foEvent.newState == 4 && _duration <=0) - { - - String lsXml = FlvControl.Player.CallFunction("<invoke name=\"getVideoTotalTime\" returntype=\"string\"></invoke>"); - //Log.Info("flash request received with :{0}",lsXml); - XmlDocument document = new XmlDocument(); - document.LoadXml(lsXml); - XmlNodeList list = document.GetElementsByTagName("number"); - _duration = Convert.ToDouble(list[0].InnerText); - Log.Info("Duration Set to {0}",_duration); - } - * */ - - } - public void OnFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent foEvent) - { - Log.Info("OnFlashCall reached with value request:{0},Object:{1}", foEvent.request, sender); - XmlDocument document = new XmlDocument(); - document.LoadXml(foEvent.request); - - // Get all the arguments - XmlNodeList list = document.GetElementsByTagName("invoke"); - String lsName = list[0].Attributes["name"].Value; - list = document.GetElementsByTagName("arguments"); - String lsState = list[0].FirstChild.InnerText; - //Log.Info("invoke:{0} argument:{1}",lsName,lsState); - //if (lsName.Equals("UpdateDuration")) - //{ - // Log.Info("received update duration with value {0}", lsState); - //} - if (lsName.Equals("updateStatus")) - { - switch (lsState) - { - case "stopped": - _playState = PlayState.Init; - break; - case "buffering": - if (_playState == PlayState.Playing) - { - //_playState = PlayState.Ended; - } - else - { - _playState = PlayState.Playing; - } - break; - case "playing": - _playState = PlayState.Playing; - String lsXml = FlvControl.Player.CallFunction("<invoke name=\"getVideoTotalTime\" returntype=\"string\"></invoke>"); - //Log.Info("flash request received with :{0}",lsXml); - document = new XmlDocument(); - document.LoadXml(lsXml); - list = document.GetElementsByTagName("number"); - _duration = Convert.ToDouble(list[0].InnerText); - Log.Info("Duration Set to {0}", _duration); - break; - case "paused": - _playState = PlayState.Paused; - break; - case "connectionError": - _playState = PlayState.Ended; - break; - - - } - } - } - - public void OnAction2(Action foAction) - { - } - public override double Duration - { - get - { - return _duration; - } - } - - public override double CurrentPosition - { - get - { - if (FlvControl == null) return 0.0d; - //UpdateStatus(); - //if (_started == false) return 0; - try - { - TimeSpan loTimeSinceUpdate = DateTime.Now - _updateTimer; - if (loTimeSinceUpdate.Seconds > 1) - { - //Log.Info("Flash Player - Updating Position"); - String lsXml = FlvControl.Player.CallFunction("<invoke name=\"getVideoCurrentTime\" returntype=\"string\"></invoke>"); - - XmlDocument document = new XmlDocument(); - document.LoadXml(lsXml); - XmlNodeList list = document.GetElementsByTagName("number"); - _currentPosition = Convert.ToDouble(list[0].InnerText); - _updateTimer = DateTime.Now; - //Log.Info("Flash Player - current time {0}", _currentPosition); - - } - } - catch (Exception e) - { - //_log.Error(e); - Log.Error(e); - } - try - { - return _currentPosition; - } - catch (Exception) - { - FlvControl = null; - return 0.0d; - } - } - - } - /* + } + /* public override int Speed { get @@ -342,336 +298,340 @@ } } } - * */ - public override bool Ended - { - get - { - return (_playState==PlayState.Ended); - } - } - public override bool Playing - { - get - { - try - { - if (FlvControl == null) - return false; - //UpdateStatus(); - //String lsPlaying = FlvControl.Player.CallFunction("<invoke name=\"videoPlaying\" returntype=\"xml\"></invoke>"); - //Log.Info("Flv Playing:{0}", lsPlaying); - //Log.Info("Player.playing:{0}", FlvControl.Player.Playing); - //Log.Info("control.playing:{0}", FlvControl.Playing); - //if (_started == false) - // return false; - //if (Paused) return true; - //return true; - return (_playState == PlayState.Playing || _playState == PlayState.Paused); + * */ + public override bool Ended + { + get + { + return (_playState==PlayState.Ended); + } + } + public override bool Playing + { + get + { + try + { + if (FlvControl == null) + return false; + //UpdateStatus(); + //String lsPlaying = FlvControl.Player.CallFunction("<invoke name=\"videoPlaying\" returntype=\"xml\"></invoke>"); + //Log.Info("Flv Playing:{0}", lsPlaying); + //Log.Info("Player.playing:{0}", FlvControl.Player.Playing); + //Log.Info("control.playing:{0}", FlvControl.Playing); + //if (_started == false) + // return false; + //if (Paused) return true; + //return true; + return (_playState == PlayState.Playing || _playState == PlayState.Paused); - } - catch (Exception) - { - FlvControl = null; - return false; - } + } + catch (Exception) + { + FlvControl = null; + return false; + } - } - } + } + } - public override void Pause() - { - if (FlvControl == null) return; - //UpdateStatus(); - //if (_started == false) return; - try - { - if (_playState == PlayState.Paused) - { - //FlvControl.Player.Play(); - FlvControl.Player.CallFunction("<invoke name=\"playVideo\" returntype=\"xml\"></invoke>"); - //_playerIsPaused = false; - } - else - { - FlvControl.Player.CallFunction("<invoke name=\"pauseVideo\" returntype=\"xml\"></invoke>"); - //FlvControl.Player.StopPlay(); - //_playerIsPaused = true; - } - } - catch (Exception) - { - FlvControl = null; - return; - } - } + public override void Pause() + { + if (FlvControl == null) return; + //UpdateStatus(); + //if (_started == false) return; + try + { + if (_playState == PlayState.Paused) + { + //FlvControl.Player.Play(); + //FlvControl.Player.CallFunction("<invoke name=\"playVideo\" returntype=\"xml\"></invoke>"); + //FlvControl.Player.CallFunction("<invoke name=\"playpause\" returntype=\"xml\"></invoke>"); + FlvControl.Player.CallFunction("<invoke name=\"sendEvent\" returntype=\"xml\"><arguments><string>playpause</string></arguments></invoke>"); + //_playerIsPaused = false; + } + else + { + //FlvControl.Player.CallFunction("<invoke name=\"pauseVideo\" returntype=\"xml\"></invoke>"); + //FlvControl.Player.CallFunction("<invoke name=\"playpause\" returntype=\"xml\"></invoke>"); + FlvControl.Player.CallFunction("<invoke name=\"sendEvent\" returntype=\"xml\"><arguments><string>playpause</string></arguments></invoke>"); + //FlvControl.Player.StopPlay(); + //_playerIsPaused = true; + } + } + catch (Exception) + { + FlvControl = null; + return; + } + } - public override bool Paused - { - get - { - try - { - //if (_started == false) return false; - //return _playerIsPaused; - return (_playState == PlayState.Paused); - } - catch (Exception) - { - FlvControl = null; - return false; - } - } - } + public override bool Paused + { + get + { + try + { + //if (_started == false) return false; + //return _playerIsPaused; + return (_playState == PlayState.Paused); + } + catch (Exception) + { + FlvControl = null; + return false; + } + } + } - public override string CurrentFile - { - get - { - return _currentFile; - } - } + public override string CurrentFile + { + get + { + return _currentFile; + } + } - public override void Process() - { - //Log.Info("in Process"); - //UpdateStatus(); - if (_needUpdate) - { - SetVideoWindow(); - } - if (CurrentPosition >= 10.0) - { - if (_notifyPlaying) - { - _notifyPlaying = false; - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null); - msg.Label = CurrentFile; - GUIWindowManager.SendThreadMessage(msg); - //Log.Info("Message Playing 10 sec sent"); - } - } - } - public override void SetVideoWindow() - { - //Log.Info("set video called fullscreen = {0} and grphic.Fullscreen {0}",_isFullScreen,GUIGraphicsContext.IsFullScreenVideo); - if (FlvControl == null) return; - if (GUIGraphicsContext.IsFullScreenVideo != _isFullScreen) - { - _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; - _needUpdate = true; - } - if (!_needUpdate) return; - _needUpdate = false; + public override void Process() + { + //Log.Info("in Process"); + //UpdateStatus(); + if (_needUpdate) + { + SetVideoWindow(); + } + if (CurrentPosition >= 10.0) + { + if (_notifyPlaying) + { + _notifyPlaying = false; + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null); + msg.Label = CurrentFile; + GUIWindowManager.SendThreadMessage(msg); + //Log.Info("Message Playing 10 sec sent"); + } + } + } + public override void SetVideoWindow() + { + + if (FlvControl == null) return; + if (GUIGraphicsContext.IsFullScreenVideo != _isFullScreen) + { + _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; + _needUpdate = true; + } + if (!_needUpdate) return; + _needUpdate = false; - if (_isFullScreen) - { - Log.Info("Flv:Fullscreen"); + if (_isFullScreen) + { + Log.Info("Flv:Fullscreen"); - _positionX = GUIGraphicsContext.OverScanLeft; - _positionY = GUIGraphicsContext.OverScanTop; - _videoWidth = GUIGraphicsContext.OverScanWidth; - _videoHeight = GUIGraphicsContext.OverScanHeight; + _positionX = GUIGraphicsContext.OverScanLeft; + _positionY = GUIGraphicsContext.OverScanTop; + _videoWidth = GUIGraphicsContext.OverScanWidth; + _videoHeight = GUIGraphicsContext.OverScanHeight; - FlvControl.Location = new Point(0, 0); - FlvControl.ClientSize = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height); - FlvControl.Size = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height); + FlvControl.Location = new Point(0, 0); + FlvControl.ClientSize = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height); + FlvControl.Size = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height); - _videoRectangle = new Rectangle(0, 0, FlvControl.ClientSize.Width, FlvControl.ClientSize.Height); - _sourceRectangle = _videoRectangle; + _videoRectangle = new Rectangle(0, 0, FlvControl.ClientSize.Width, FlvControl.ClientSize.Height); + _sourceRectangle = _videoRectangle; - //FlvControl.fullScreen=true; - //FlvControl.stretchToFit = true; - //Log.Info("FlvPlayer:done"); - return; - } - else - { + //FlvControl.fullScreen=true; + //FlvControl.stretchToFit = true; + //Log.Write("FlvPlayer:done"); + return; + } + else + { - FlvControl.ClientSize = new System.Drawing.Size(_videoWidth, _videoHeight); - FlvControl.Location = new Point(_positionX, _positionY); + FlvControl.ClientSize = new System.Drawing.Size(_videoWidth, _videoHeight); + FlvControl.Location = new Point(_positionX, _positionY); - _videoRectangle = new Rectangle(_positionX, _positionY, FlvControl.ClientSize.Width, FlvControl.ClientSize.Height); - _sourceRectangle = _videoRectangle; - //Log.Info("AudioPlayer:set window:({0},{1})-({2},{3})",_positionX,_positionY,_positionX+FlvControl.ClientSize.Width,_positionY+FlvControl.ClientSize.Height); - } - //FlvControl.uiMode = "none"; - //FlvControl.windowlessVideo = true; - //FlvControl.enableContextMenu = false; - //FlvControl.Ctlenabled = false; - GUIGraphicsContext.form.Controls[0].Enabled = false; - } + _videoRectangle = new Rectangle(_positionX, _positionY, FlvControl.ClientSize.Width, FlvControl.ClientSize.Height); + _sourceRectangle = _videoRectangle; + //Log.Write("AudioPlayer:set window:({0},{1})-({2},{3})",_positionX,_positionY,_positionX+FlvControl.ClientSize.Width,_positionY+FlvControl.ClientSize.Height); + } + + GUIGraphicsContext.form.Controls[0].Enabled = false; + } - public override void Stop() - { - if (FlvControl == null) return; - try - { - //Log.Info("before {0}", Playing); - //FlvControl.Player.Stop(); - FlvControl.Player.CallFunction("<invoke name=\"stopVideo\" returntype=\"xml\"></invoke>"); - FlvControl.Visible = false; - FlvControl.ClientSize = new Size(0, 0); - FlvControl.Dispose(); - //_playerIsPaused = false; - //_started = false; - //Playing = false; - //GUIGraphicsContext.OnNewAction -= new OnActionHandler(OnAction2); - //Log.Info("after {0}", Playing); - } - catch (Exception) - { - FlvControl = null; - } - } + public override void Stop() + { + //Log.Info("Attempting to stop..."); + if (FlvControl == null) return; + try + { + //Log.Info("before {0}", Playing); + //FlvControl.Player.Stop(); + //FlvControl.Player.CallFunction("<invoke name=\"stopVideo\" returntype=\"xml\"></invoke>"); + //FlvControl.Player.CallFunction("<invoke name=\"stop\" returntype=\"xml\"></invoke>"); + FlvControl.Player.CallFunction("<invoke name=\"sendEvent\" returntype=\"xml\"><arguments><string>stop</string></arguments></invoke>"); - public override bool HasVideo - { - get - { - return true; - } - } + FlvControl.Visible = false; + FlvControl.ClientSize = new Size(0, 0); + FlvControl.Dispose(); + //_playerIsPaused = false; + //_started = false; + //Playing = false; + //GUIGraphicsContext.OnNewAction -= new OnActionHandler(OnAction2); + //Log.Info("after {0}", Playing); + } + catch (Exception) + { + FlvControl = null; + } + } - public override bool FullScreen - { - - get - { - return _isFullScreen; - } - set - { - if (value != _isFullScreen) - { - //Log.Info("setting fullscreen to {0}", value); - _isFullScreen = value; - _needUpdate = true; - } - } - } + public override bool HasVideo + { + get + { + return true; + } + } - public override int PositionX - { - get { return _positionX; } - set - { - if (value != _positionX) - { - //Log.Info("setting position x to {0}", value); - _positionX = value; - _needUpdate = true; - } - } - } + public override bool FullScreen + { + + get + { + return _isFullScreen; + } + set + { + if (value != _isFullScreen) + { + //Log.Info("setting fullscreen to {0}", value); + _isFullScreen = value; + _needUpdate = true; + } + } + } - public override int PositionY - { - get { return _positionY; } - set - { - if (value != _positionY) - { - //Log.Info("setting position y to {0}", value); - _positionY = value; - _needUpdate = true; - } - } - } + public override int PositionX + { + get { return _positionX; } + set + { + if (value != _positionX) + { + //Log.Info("setting position x to {0}", value); + _positionX = value; + _needUpdate = true; + } + } + } - public override int RenderWidth - { - get { return _videoWidth; } - set - { - if (value != _videoWidth) - { - //Log.Info("setting width to {0}", value); - _videoWidth = value; - _needUpdate = true; - } - } - } - public override int RenderHeight - { - get { return _videoHeight; } - set - { - if (value != _videoHeight) - { - //Log.Info("setting position height to {0}", value); - _videoHeight = value; - _needUpdate = true; - } - } - } + public override int PositionY + { + get { return _positionY; } + set + { + if (value != _positionY) + { + //Log.Info("setting position y to {0}", value); + _positionY = value; + _needUpdate = true; + } + } + } + public override int RenderWidth + { + get { return _videoWidth; } + set + { + if (value != _videoWidth) + { + //Log.Info("setting width to {0}", value); + _videoWidth = value; + _needUpdate = true; + } + } + } + public override int RenderHeight + { + get { return _videoHeight; } + set + { + if (value != _videoHeight) + { + //Log.Info("setting position height to {0}", value); + _videoHeight = value; + _needUpdate = true; + } + } + } - - public override void SeekRelative(double dTime) - { - double dCurTime = CurrentPosition; - dTime = dCurTime + dTime; - if (dTime < 0.0d) dTime = 0.0d; - if (dTime < Duration) - { - SeekAbsolute(dTime); - } - } - public override void SeekAbsolute(double dTime) - { - if (dTime < 0.0d) dTime = 0.0d; - if (dTime < Duration) - { - if (FlvControl == null) return; - try - { - Log.Info("Attempting to seek..."); - FlvControl.Player.CallFunction("<invoke name=\"videoSeek\" returntype=\"xml\"><arguments><number>" + dTime + "</number></arguments></invoke>"); - //FlvControl.Player.CurrentFrame() = (int)dTime; - Log.Info("seeking complete"); - } - catch (Exception e) { - Log.Error(e); - } - } - } + + public override void SeekRelative(double dTime) + { + double dCurTime = CurrentPosition; + dTime = dCurTime + dTime; + if (dTime < 0.0d) dTime = 0.0d; + if (dTime < Duration) + { + SeekAbsolute(dTime); + } + } - public override void SeekRelativePercentage(int iPercentage) - { - double dCurrentPos = CurrentPosition; - double dDuration = Duration; + public override void SeekAbsolute(double dTime) + { + if (dTime < 0.0d) dTime = 0.0d; + if (dTime < Duration) + { + if (FlvControl == null) return; + try + { + Log.Info("Attempting to seek..."); + //FlvControl.Player.CallFunction("<invoke name=\"videoSeek\" returntype=\"xml\"><arguments><number>" + dTime + "</number></arguments></invoke>"); + //FlvControl.Player.CallFunction("<invoke name=\"scrub\" returntype=\"xml\"><arguments><number>" + dTime + "</number></arguments></invoke>"); + FlvControl.Player.CallFunction("<invoke name=\"sendEvent\" returntype=\"xml\"><arguments><string>scrub</string><number>" + dTime + "</number></arguments></invoke>"); + //FlvControl.Player.CurrentFrame() = (int)dTime; + Log.Info("seeking complete"); + } + catch (Exception e) { + Log.Error(e); + } + } + } - double fCurPercent = (dCurrentPos / Duration) * 100.0d; - double fOnePercent = Duration / 100.0d; - fCurPercent = fCurPercent + (double)iPercentage; - fCurPercent *= fOnePercent; - if (fCurPercent < 0.0d) fCurPercent = 0.0d; - if (fCurPercent < Duration) - { - SeekAbsolute(fCurPercent); - } - } + public override void SeekRelativePercentage(int iPercentage) + { + double dCurrentPos = CurrentPosition; + double dDuration = Duration; + double fCurPercent = (dCurrentPos / Duration) * 100.0d; + double fOnePercent = Duration / 100.0d; + fCurPercent = fCurPercent + (double)iPercentage; + fCurPercent *= fOnePercent; + if (fCurPercent < 0.0d) fCurPercent = 0.0d; + if (fCurPercent < Duration) + { + SeekAbsolute(fCurPercent); + } + } - public override void SeekAsolutePercentage(int iPercentage) - { - if (iPercentage < 0) iPercentage = 0; - if (iPercentage >= 100) iPercentage = 100; - double fPercent = Duration / 100.0f; - fPercent *= (double)iPercentage; - SeekAbsolute(fPercent); - } - //private void VideoEnded - //{ - //} + public override void SeekAsolutePercentage(int iPercentage) + { + if (iPercentage < 0) iPercentage = 0; + if (iPercentage >= 100) iPercentage = 100; + double fPercent = Duration / 100.0f; + fPercent *= (double)iPercentage; + SeekAbsolute(fPercent); + } + - } + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-23 15:02:52 UTC (rev 861) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-24 03:45:27 UTC (rev 862) @@ -238,7 +238,7 @@ if (dlgSel != null) { dlgSel.Add("Save"); // Save - Log.Info("msSelectedCategoryValue = "+msSelectedCategoryValue); + //Log.Info("msSelectedCategoryValue = "+msSelectedCategoryValue); if(msSelectedCategoryValue.StartsWith("fav:") ==false){ dlgSel.Add("Add to favorites"); } @@ -254,7 +254,7 @@ } dlgSel.DoModal(GetID); int liSelectedIdx = dlgSel.SelectedId; - Log.Info("Selected id {0}",liSelectedIdx); + //Log.Info("Selected id {0}",liSelectedIdx); switch(liSelectedIdx){ case 1: SaveVideo(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); @@ -276,14 +276,14 @@ //Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); //Log.Info("VideoList before:"); - foreach(VideoInfo video in moCurrentVideoList){ - Log.Info(video.Title); - } + //foreach(VideoInfo video in moCurrentVideoList){ + //Log.Info(video.Title); + //} moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); //Log.Info("VideoList after:"); - foreach(VideoInfo video in moCurrentVideoList){ - Log.Info(video.Title); - } + //foreach(VideoInfo video in moCurrentVideoList){ + // Log.Info(video.Title); + //} DisplayVideos(false); break; @@ -314,7 +314,7 @@ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { //Log.Info("Onclicked action type:{0}",actionType); - if (control == facadeView) + if (control == facadeView && actionType== Action.ActionType.ACTION_SELECT_ITEM) { if (_CurrentState == State.home) @@ -659,9 +659,7 @@ DisplayVideoInfo(moCurrentVideoList[item.ItemId-1]); } } - public void OnAction2(Action foAction){ - Log.Info("MyFlashPlayer received action:"+foAction.wID); - } + private bool GetUserInputString(ref string sString) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-23 15:02:52 UTC (rev 861) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-24 03:45:27 UTC (rev 862) @@ -54,7 +54,7 @@ { //ServiceProvider loServices = GlobalServiceProvider.Instance; //moLog = loServices.Get<ILog>(); - } + } public virtual List<GUIOnlineVideos.VideoInfo> getSiteFavorites(String fsUser){ return new List<GUIOnlineVideos.VideoInfo>(); @@ -78,7 +78,7 @@ Log.Info("SiteUtilBase AddFavorites."); FavoritesDatabase db = FavoritesDatabase.getInstance(); db.addFavoriteVideo(foVideo,fsSiteId); - + } public virtual bool RemoveFavorite(GUIOnlineVideos.VideoInfo foVideo){ Log.Info("SiteUtilBase removeFavorites."); @@ -93,149 +93,155 @@ public List<RssItem> getRssDataItems(String fsUrl){ - XmlDocument doc = new XmlDocument(); - XmlReaderSettings settings = new XmlReaderSettings(); - settings.ProhibitDtd = false; - //doc.Load(XmlReader.Create(fsUrl,settings)); - - WebClient client =new WebClient(); - String xml = client.DownloadString(fsUrl); - doc.LoadXml(xml); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - expr.AddNamespace("exInfo","http://www.gametrailers.com/rssexplained.php"); - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - //XmlAttributeCollection ac; List<RssItem> loRssItems = new List<RssItem>(); - RssItem loRssItem; - //GUIListItem loListItem; - MediaContent loMediaContent; - int itemCount = 0; - foreach (XmlNode chileNode in nodeList) - { - if(itemCount>=100){ - break; - } - itemCount++; - loRssItem = new RssItem(); - - for (int i = 0; i < chileNode.ChildNodes.Count; i++) + try{ + XmlDocument doc = new XmlDocument(); + XmlReaderSettings settings = new XmlReaderSettings(); + settings.ProhibitDtd = false; + //doc.Load(XmlReader.Create(fsUrl,settings)); + + WebClient client =new WebClient(); + String xml = client.DownloadString(fsUrl); + doc.LoadXml(xml); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + expr.AddNamespace("exInfo","http://www.gametrailers.com/rssexplained.php"); + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//rss/channel/item"); + //XmlAttributeCollection ac; + + RssItem loRssItem; + //GUIListItem loListItem; + MediaContent loMediaContent; + int itemCount = 0; + foreach (XmlNode chileNode in nodeList) { - XmlNode n = chileNode.ChildNodes[i]; + if(itemCount>=100){ + break; + } + itemCount++; + loRssItem = new RssItem(); - switch (n.Name) + for (int i = 0; i < chileNode.ChildNodes.Count; i++) { - - case "title": - loRssItem.title = n.InnerText; - break; - case "link": - loRssItem.link = n.InnerText; - break; - case "guid": - loRssItem.guid = n.InnerText; - break; - case "pubDate": - loRssItem.pubDate = n.InnerText; - break; - case "description": - loRssItem.description = n.InnerText; - break; - case "author": - loRssItem.author = n.InnerText; - break; - case "exInfo:image": - loRssItem.exInfoImage = n.InnerText; - break; - case "media:group": - - for (int j = 0; j < n.ChildNodes.Count; j++) - { - XmlNode nin = n.ChildNodes[j]; - switch (nin.Name) + XmlNode n = chileNode.ChildNodes[i]; + + switch (n.Name) + { + + case "title": + loRssItem.title = n.InnerText; + break; + case "link": + loRssItem.link = n.InnerText; + break; + case "guid": + loRssItem.guid = n.InnerText; + break; + case "pubDate": + loRssItem.pubDate = n.InnerText; + break; + case "description": + loRssItem.description = n.InnerText; + break; + case "author": + loRssItem.author = n.InnerText; + break; + case "exInfo:image": + loRssItem.exInfoImage = n.InnerText; + break; + case "media:group": + + for (int j = 0; j < n.ChildNodes.Count; j++) { - - case "media:content": - loMediaContent = new MediaContent(); - try{ - loMediaContent.url = nin.Attributes["url"].Value; - loMediaContent.type = nin.Attributes["type"].Value; - loMediaContent.medium = nin.Attributes["medium"].Value; - loMediaContent.duration = nin.Attributes["duration"].Value; - loMediaContent.height = nin.Attributes["height"].Value; - loMediaContent.width = nin.Attributes["width"].Value; - }catch(Exception){}; - loRssItem.contentList.Add(loMediaContent); - break; - case "media:description": - loRssItem.mediaDescription = n.InnerText; - break; - case "media:thumbnail": - loRssItem.mediaThumbnail = nin.Attributes["url"].Value; - break; - case "media:title": - loRssItem.mediaTitle = nin.InnerText; - break; - + XmlNode nin = n.ChildNodes[j]; + switch (nin.Name) + { + + case "media:content": + loMediaContent = new MediaContent(); + try{ + loMediaContent.url = nin.Attributes["url"].Value; + loMediaContent.type = nin.Attributes["type"].Value; + loMediaContent.medium = nin.Attributes["medium"].Value; + loMediaContent.duration = nin.Attributes["duration"].Value; + loMediaContent.height = nin.Attributes["height"].Value; + loMediaContent.width = nin.Attributes["width"].Value; + }catch(Exception){}; + loRssItem.contentList.Add(loMediaContent); + break; + case "media:description": + loRssItem.mediaDescription = n.InnerText; + break; + case "media:thumbnail": + loRssItem.mediaThumbnail = nin.Attributes["url"].Value; + break; + case "media:title": + loRssItem.mediaTitle = nin.InnerText; + break; + + } } - } - break; - case "media:content": - loMediaContent = new MediaContent(); - loMediaContent.url = n.Attributes["url"].Value; - loMediaContent.type = n.Attributes["type"].Value; - loMediaContent.medium = n.Attributes["medium"].Value; - loMediaContent.duration = n.Attributes["duration"].Value; - loMediaContent.height = n.Attributes["height"].Value; - loMediaContent.width = n.Attributes["width"].Value; - loRssItem.contentList.Add(loMediaContent); - for (int j = 0; j < n.ChildNodes.Count; j++) - { - XmlNode nin = n.ChildNodes[j]; - - switch (nin.Name) + break; + case "media:content": + loMediaContent = new MediaContent(); + loMediaContent.url = n.Attributes["url"].Value; + loMediaContent.type = n.Attributes["type"].Value; + loMediaContent.medium = n.Attributes["medium"].Value; + loMediaContent.duration = n.Attributes["duration"].Value; + loMediaContent.height = n.Attributes["height"].Value; + loMediaContent.width = n.Attributes["width"].Value; + loRssItem.contentList.Add(loMediaContent); + for (int j = 0; j < n.ChildNodes.Count; j++) { - case "media:description": - loRssItem.mediaDescription = n.InnerText; - break; - case "media:thumbnail": - loRssItem.mediaThumbnail = nin.Attributes["url"].Value; - break; - case "media:title": - loRssItem.mediaTitle = nin.InnerText; - break; - + XmlNode nin = n.ChildNodes[j]; + + switch (nin.Name) + { + case "media:description": + loRssItem.mediaDescription = n.InnerText; + break; + case "media:thumbnail": + loRssItem.mediaThumbnail = nin.Attributes["url"].Value; + break; + case "media:title": + loRssItem.mediaTitle = nin.InnerText; + break; + + } } - } - break; - case "media:description": - loRssItem.mediaDescription = n.InnerText; - break; - case "media:thumbnail": - loRssItem.mediaThumbnail = n.Attributes["url"].Value; - break; - case "media:title": - loRssItem.mediaTitle = n.InnerText; - break; - case "enclosure": - loRssItem.enclosure = n.Attributes["url"].Value; - if(n.Attributes["duration"]!=null){ - loRssItem.enclosureDuration = n.Attributes["duration"].Value; - } - - break; - case "media:category": - loRssItem.mediaCategory = n.InnerText; - break; - default: - break; + break; + case "media:description": + loRssItem.mediaDescription = n.InnerText; + break; + case "media:thumbnail": + loRssItem.mediaThumbnail = n.Attributes["url"].Value; + break; + case "media:title": + loRssItem.mediaTitle = n.InnerText; + break; + case "enclosure": + loRssItem.enclosure = n.Attributes["url"].Value; + if(n.Attributes["duration"]!=null){ + loRssItem.enclosureDuration = n.Attributes["duration"].Value; + } + + break; + case "media:category": + loRssItem.mediaCategory = n.InnerText; + break; + default: + break; + } } + loRssItems.Add(loRssItem); } - loRssItems.Add(loRssItem); - } + }catch(Exception e){ + Log.Error(e); + } + return loRssItems; } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.cs 2007-08-23 15:02:52 UTC (rev 861) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.cs 2007-08-24 03:45:27 UTC (rev 862) @@ -33,7 +33,7 @@ } protected override String getUrl(String fsId) { - return fsId; + return fsId+"&txe=.avi"; } public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos.sln =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos.sln 2007-08-23 15:02:52 UTC (rev 861) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos.sln 2007-08-24 03:45:27 UTC (rev 862) @@ -1,7 +1,7 @@ - + Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -# SharpDevelop 2.1.0.2429 +# SharpDevelop 2.2.0.2595 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineVideos", "OnlineVideos\OnlineVideos.csproj", "{E0D9D390-CDD6-4B98-86F3-6EB04A958882}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Runner", "OnlineVideos\Runner.csproj", "{EFABB07B-B050-45AD-A93F-C5047F15512F}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |