Get Videourl from OV in MP2 (1 Viewer)

FreakyJ

Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Hey @offbyone
    I'm just trying to port the MPCast Plugin to MP2. In MP1 it is possible to get the Videourl using this code (stolen from Mytrailers^^):
    Code:
    class OnlineVideosTrailersHosterProxy : MarshalByRefObject
        {
            public OnlineVideosTrailersHosterProxy() { }
    
            public Dictionary<string, string> GetPlaybackOptions(string url)
            {
                return HosterFactory.GetHoster("Youtube").getPlaybackOptions(url);
            }
    
            public string GetVideoUrls(string url)
            {
              var allHoster = OnlineVideos.Hoster.Base.HosterFactory.GetAllHosters();
              MPCastServer.getInstance().logger.Info("Onlinevideos: Count {0}", allHoster.Count);
              foreach (var hoster in allHoster)
              {
                MPCastServer.getInstance().logger.Info("Onlinevideos: {0}", hoster.getHosterUrl());
              }
              return HosterFactory.GetHoster("Youtube").getVideoUrls(url);
            }
        }

    But in MP2 I get 0 hosters, do you know why it is so? Or better can you tell me how to do the same in MP2? :p
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    All Hosters are defined in the siteutil dlls, so they must be present (downloaded when the automatic update on entering OV runs). Can you play YouTube videos in OV-MP2?
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Can you play YouTube videos in OV-MP2?
    yes I can :)
    And OnlineVideos.Hoster.Base.HosterFactory.GetAllHosters() gives me zero hoster :/
     

    Attachments

    • OVMP2 Youtube.png
      OVMP2 Youtube.png
      219.4 KB

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    Just to be sure:
    a) go into OnlineVideos, YouTube, play a video. (so we can be sure the Hosters are initialized - Hoster != Site, even though in your case both have the same name)
    b) execute your code -> still 0 hoster?
    c) be confused :)
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    playing a video works :)
    But the code still says 0 oO To be honest my code is hacked together from the MP2 Airplayer and the MPCast plugin because I never written a MP2 plugin yet... but at least this line of code should return a value grater than 0 oO
     

    Attachments

    • OVMP2 Youtube2.png
      OVMP2 Youtube2.png
      327.6 KB

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    It might have to do with the second AppDomain that OV hosts all sites and hosters in. How are you creating the instance of your OnlineVideosTrailersHosterProxy ? It should be some call to "unwrap" the object from the other domain not a simple new.
    Code:
    OnlineVideosAppDomain.Domain.CreateInstanceAndUnwrap(...)
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Yes, this part looks like this:
    Code:
     // Load OnlineVideos Assembly from OV AppDomain.
              var ovHosterProxy = OnlineVideosAppDomain.Domain.CreateInstanceAndUnwrap(typeof(OnlineVideosTrailersHosterProxy).Assembly.FullName, typeof(OnlineVideosTrailersHosterProxy).FullName) as OnlineVideosTrailersHosterProxy;
              var ovURLS = ovHosterProxy.GetVideoUrls(ytURL);
              MPCastServer.getInstance().logger.Info("Onlinevideos: {0}", ovURLS);
    I just attached the whole file :)
     

    Attachments

    • YoutubeApp.rar
      2.1 KB

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Sure :)
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    Hm there's no line in the log about OnlineVideos being initialized?
    Like:
    Code:
    [2014-08-18 19:10:24,920] [32161  ] [AMQ 'OnlineVideosWorkflowModel'] [INFO ] - [OnlineVideos] Found 141 SiteUtils and 59 Hosters in 12 assemblies
     

    Users who are viewing this thread

    Top Bottom