[WebService] General Media Access Webservice (3 Viewers)

Mike Lowrey

Portal Pro
February 4, 2009
638
124
Berlin
Home Country
Germany Germany
Yeah that sounds good! May be i can just replace the sql subclass :)

If you are interested in playing around with ASP.Net MVC just work trough this tutorial Part 1: Overview and File->New Project: The Official Microsoft ASP.NET Site MVC is the most sophisticated framework i've ever seen.

In reference to the live streaming you have to add a method to the specific "Controller" for example MovieLibraryController which gets the url with the transcoded stream, in your View you can access this implementation and bind the url to a HTML5 video tags or any other kind of player.

My problem so far is that i have no idea how to get such an url ;)


The prefixing is done because my original idea was to expand the service to more than the MP databases. For example XBMC, WMP or any other database which seems to be interesting.
 

Oxan

Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Great that you like my idea :)

    Yeah, I had found that tutorial myself too. I've already worked with MVC in other languages (PHP, Python), but the Microsoft implementation is indeed one of the best I've seen.

    I kinda figured that out, but the probleem is indeed the URL. I'm experimenting a bit with referencing the MPWebStream code and generating an URL myself now (using a subaction of the controller) and it's starting to look like this will actually work. :) I'll post the code somewhere if I have something that can be useful.

    Expanding it too other databases sounds interesting, but I wonder if it isn't better to use a single API. That way you can quite easily add XMBC support to all consuming services such as aMPdroid. I don't know if the databases look enough like each other to do that though.
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    That sounds promising!

    Yes your right, a single API would be better and that was my idea behind the things i've posted in the collaboration thread. But since this needs much more time than i had availaible when i started working on the service i started with a subset of features :)

    May be i have the time to check whether a single api is doable in a limited amount of time.
     

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Adding live streaming turns out to be pretty simple, just adding this code to TelevisionController.cs (and a reference to the development version of MPWebStream) and it's working:
    Code:
            public ActionResult Stream() 
            {
                TranscoderProfile profile = new TranscoderProfile() {
                    UseTranscoding = false,
                    MIME = "video/MP2T"
                };
                WebChannelBasic channel = ServiceInstance.GetChannelBasicById(301);
                string username = "webmediaportal-" + System.Guid.NewGuid().ToString("D");
                WebVirtualCard card = ServiceInstance.SwitchTVServerToChannelAndGetVirtualCard(username, channel.IdChannel);
    
                TranscodingStreamer streamer = new TranscodingStreamer(card.RTSPUrl, card.TimeShiftFileName, profile);
                streamer.TranscodeToClient(Response);
                ServiceInstance.CancelCurrentTimeShifting(username);
                return new EmptyResult();
            }
    Of course there's more code needed to read configuration, arguments, handle authentication and provide some flexibility, but this is the basic. If you're okay with it I'm going to implement the rest and create a patch for it.

    For the rest: great! I have some time to work on the refactoring too, so just ask if you need help :)
     

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Okay, that's great.

    I've looked a bit more into GMA. It looks good, but it could use a little refactoring. For example, it would be nice if the duplication of code between the four databases is reduced a bit. I'm also not sure if it's a good idea to return paths from a service, but the way it's currently done (with retrieval functions) seems to be a good compromise. It only has a major security problem; you can retrieve every file on the system using the service.

    As for WebMediaPortal; I've gone ahead and implemented the Live TV streaming (which needs some UI work and a proper way to integrate the stream in the browser) and saving of users in an XML file (which needs some rethinking about how configuration is stored; I don't think it's a great idea to drop it into the config.xml file read by GMA), dropping the MSSQL dependency.
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    I'm also not sure if it's a good idea to return paths from a service, but the way it's currently done (with retrieval functions) seems to be a good compromise. It only has a major security problem; you can retrieve every file on the system using the service.
    Yeah this isn't something i really like too, but since some parts of the databases do not offer enough possibilities to work around this and i'm not interested in designing a database only to work around these things i haven't had much choice ;)

    My idea to secure the stuff was to start the service under a different user which has only access to the used shared.

    Regarding WebMediaPortal is it possible for you to also look on how to implement streaming for movies? If you have done this once i would be able to to this for the other media types too.

    My "dream" in reference to the whole log in stuff was to access the Windows NTLM system. With this we would have a working default user, a secure way to store username and passwords.
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    For all devs who are working with the webservice:

    Today i've added sort and order features the definitions can be found in the Interfaces project.
    I also talked with diebagger who will check whether a sub category for webservices in the MP wiki is useful(and wanted) or not. If this is done i will add some documentation to it :)
     

    mardup

    Portal Pro
    October 24, 2007
    153
    8
    Toulouse
    Home Country
    France France
    Re : [WebService] General Media Access Webservice

    Hey ...

    I don't know why, but I can't install GmaWebService .... :

    > I double click the installer
    > I see the progress bar
    > .. and then, the install windows desapear, with no (error) message.
    In program files directory there is no GMAWebService directory

    I install / uninstall / reinstall .NET 4.0 full many times ... My login user is administrator. UAC is OFF ... no firewall, no antivirus
    My system is Win 7 x32

    If I look in program files directory during install, I see the directory GmaWebService appear ... and disappear

    Is there somewhere an install/error log that I can check to see what's happen ?

    Thanks for your help
     

    Users who are viewing this thread

    Top Bottom