Graphics

 View Only
  • 1.  Loading a Specific Webpage Through Scripting?

    Posted 01-17-2025 13:30

    Hi all--question for you regarding scripting...

    Our producers sometimes like to use live webpages during newscasts; our current setup relies on them loading the page on their PC, which is available to the director as a source on our switcher.  What I'd really like to do is build an XPression template which would show a webpage on a quad.  I've seen how to use the Window Capture on a material, which is how I'm sure it would work.  What I'd really like to do, though, is to have a graphic where producers could open the template through the MOS plug-in in iNews; the template would have a hidden text object for them to enter a URL.  When the graphic was played, it would trigger Chrome to load the given URL and the Window Capture texture would then grab it and display it on a quad.  I know it would take time for the page to load doing it this way, but in our setup, that would be okay.

    I'm hoping there's something I could do in scripting that would make that possible; I'm beyond the "dipping my toes into the water" level of scripting, but I'm still new enough to be in the "stay in the shallow end of the pool" level, so I'm not sure how I'd go about making that happen.

    Anyone have any ideas to push me in the right direction?

    Thanks!



    ------------------------------
    Ben Scripps
    Assistant Operations Manager
    WWTV Cadillac MI
    ------------------------------


  • 2.  RE: Loading a Specific Webpage Through Scripting?

    Posted 01-17-2025 17:06

    Perhaps Ross has a better idea than I do. I haven't done it but have done a 10 minute search for some info.

    1) Have a server that can render a webpage from the command line.

    This has many problems. Biggest is feedback in the MOS plugin or just getting the image in a timely manor. But here are some rabbit-hole links for you:

    https://wkhtmltopdf.org/

    https://superuser.com/questions/280552/how-can-i-render-a-website-as-an-image-from-the-shell

    https://softwarerecs.stackexchange.com/questions/50269/command-line-utility-for-rendering-htmlcss-to-image

    https://stackoverflow.com/questions/3318490/generate-image-e-g-jpg-of-a-web-page

    2)File server + browser extension

    Believe it or not, browser plugins are easy to make, and so is turning a webpage into an image.

    Have a file server that accepts http uploads.

    Write an extension that does a webpage capture and sends the data to the file server.

    MOS and production boxes can access file server.

    Extension should resize window to a predetermined size for rendering to look best on air.

    This would be the preferred method because there would be no race condition issues with rendering. You just have a push button solution for your news producers ( because they aren't always the brightest ). 



    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------



  • 3.  RE: Loading a Specific Webpage Through Scripting?

    Posted 01-21-2025 11:33

    Thanks for that info--I'll definitely look into this as a path forward, but I know our news director is adamant that it be a live page (one of the things we use is showing power outage maps from the local electric utility, so it needs to be at least close to live). 

    We do have a Streamline server in our setup, so producers have a way of grabbing screen caps and adding that way, but I was hoping for something a little closer to an actual live webpage.  (Producers could just do a screen cap at the last minute, but building on your observation, I wouldn't want to be reliant on that...)

    Thanks!



    ------------------------------
    Ben Scripps
    Assistant Operations Manager
    WWTV Cadillac MI
    ------------------------------



  • 4.  RE: Loading a Specific Webpage Through Scripting?

    Posted 01-21-2025 11:59

    If you want to show power outages, hopefully the website has an API. In which you can get raw data and display it. Showing the outages website instead of getting data is kinda' crap solution.

    Power outage data is available from here:

    https://poweroutage.us/products

    It's not free, but is better than trying to display a website.

    The point of expression is you can create graphics. Showing a screen capture of a website degrades Xpression to Powerpoint.



    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------



  • 5.  RE: Loading a Specific Webpage Through Scripting?

    Posted 01-22-2025 14:34

    Hey Ben!

    I'm gonna put this out there with a couple of warning flags!

    (1) I've put this script in an event block on the scene director that's meant to run. I think that's probably the safest place.

    (2) THIS MAY CAUSE THE ENGINE TO BRIEFLY HOLD UP. We're telling Windows to open another app for us. The rendering will briefly pause while Windows does that for us. Without declaring a browser (or really, the specific program we want to start), Windows default opened up my Android subsystem, and that paused my XPression for half a second. When I declare firefox or chrome, it seems pretty quick (at least, not noticable), though this may be since it was already open. Easy enough to work around, since you'll want to already have it open for the window capture.

    With that being said: In my scene, I've got a URL text object called "URL". Then, in the script in the Scene Director,

    dim url_obj as xpTextObject
    Scene.GetObjectByName("URL", url_obj)
    
    System.Diagnostics.Process.Start("firefox", url_obj.Text)

    Note the "firefox" as the first parameter in the Process.Start command. You may want that to be "chrome".



    ------------------------------
    Zachary Fradette
    United States
    ------------------------------



  • 6.  RE: Loading a Specific Webpage Through Scripting?

    Posted 01-22-2025 19:12

    Oh, that works like a champ--thanks much!



    ------------------------------
    Ben Scripps
    Assistant Operations Manager
    WWTV Cadillac MI
    ------------------------------