CEF, New Media, and Old Videos

Recently (June 23rd), the Linden viewer released with an important update to "CEF" - the Chromium Embedded Framework that's used for viewing web pages and -- crucially -- media. At the time of writing, only the Linden viewer has this support, but third party viewers will likely adopt this feature very soon.

Support for the new CEF version first surfaced in a project viewer that used streaming media for the Adult Swim "The Shivering Truth" event, in May.

But there are broader benefits of the enhanced media support. Notably, other video services and formats are now supported that before would give a blank screen (at best). One such service is Vimeo, fairly widely used in entertainment and, specific to SL, the home of an exhaustive archive of old Designing Worlds videos that were once hosted by Treet TV.

Unlocking these Vimeo-based archives needs a bit of tweaking on in-world video players. It's actually possible to play these videos on either "Shared Media" surfaces (aka "Media on a Prim") or Parcel Media. Both will use a custom URL that embeds Vimeo's proprietary streaming player to see the video directly instead of a web page surrounding the player. The basic player URL is offered as a way to "Share" the video from the regular Vimeo web page, but there are a lot of confusing options. What I've found to work best is to copy the number in the Vimeo webpage URL (call that VIMEO_NUMBER), and splice it into an address as follows:
https://player.vimeo.com/video/VIMEO_NUMBER?autoplay=1&loop=1
which sets it to autoplay and loop by default. (Note the "player" in that address.)

Both Shared and Parcel media also face a quirk of the Vimeo player: it displays the video in the center 56.25% of the vertical surface texture - a huge "letterbox" effect. To get around this, a script can scale the texture to stretch out that strip to span the whole height of the surface, or you can do this manually in the editor. (To get a black letterbox, include "&transparent=0" in the URL.)

When presented in Shared Media, the user can interact directly with the viewer by clicking on it (or using the keyboard with the surface selected), so you'll likely want to turn off the Shared Media control options that hover above the display. Unlike Shared Media, Parcel media has no means of interacting directly with the viewer, so using "&controls=0" will hide the Vimeo player scrollbars, etc. (Some Parcel media players have their own controls, *some* of which will operate the Vimeo player stream.)

Here's a little script that does what's described here for both Shared and Parcel media, using a couple different Designing Worlds episodes of personal interest.

==================
Vimeo Media Script
==================

string VIMEO_NUMBER = "427716338";
integer MEDIA_FACE = 1;
mediaError(integer num)
{
list MEDIA_ERRORS =
[ STATUS_MALFORMED_PARAMS, "Function was called with malformed parameters"
, STATUS_TYPE_MISMATCH, "Argument(s) passed to function had a type mismatch"
, STATUS_BOUNDS_ERROR, "Argument(s) passed to function had a bounds error"
, STATUS_NOT_FOUND, "Object or other item was not found"
, STATUS_NOT_SUPPORTED, "Feature not supported"
, STATUS_INTERNAL_ERROR, "An internal error occurred"
, STATUS_WHITELIST_FAILED, "Whitelist Failed"
];
llWhisper(DEBUG_CHANNEL, "Shared media error encountered: "
+ llList2String(MEDIA_ERRORS, llListFindList(MEDIA_ERRORS, [num])+1));
}
default
{
state_entry()
{
integer errNum = llClearLinkMedia(LINK_THIS, MEDIA_FACE);
if (errNum)
{
mediaError(errNum);
return;
}
string html = "https://player.vimeo.com/video/"
+ VIMEO_NUMBER
+ "?autoplay=1&loop=1";?
llScaleTexture(1.0, 0.5625, MEDIA_FACE);
errNum = llSetLinkMedia(LINK_THIS, MEDIA_FACE,
[ PRIM_MEDIA_AUTO_PLAY, TRUE
, PRIM_MEDIA_CURRENT_URL, html
, PRIM_MEDIA_HOME_URL, html
, PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE
]);
if (errNum)
mediaError(errNum);
// parcel
// return; // to prevent setting PARCEL media
html = "https://player.vimeo.com/video/"
+ "375405889"
+ "?autoplay=1&loop=1&controls=0&transparent=0";
llParcelMediaCommandList([ PARCEL_MEDIA_COMMAND_STOP]);
llParcelMediaCommandList([ PARCEL_MEDIA_COMMAND_UNLOAD]);
llParcelMediaCommandList(
[ PARCEL_MEDIA_COMMAND_URL, html
, PARCEL_MEDIA_COMMAND_TYPE, "text/html"
]);
llParcelMediaCommandList([ PARCEL_MEDIA_COMMAND_PLAY]);
}
}


==================

All the scripted operations can be done manually, too, and may work in existing in-world media players. Note that a parcel media script must be owned by the landowner, so on group owned land it must be deeded to the group. And remember that you'll need a viewer supporting the CEF updates to actually watch the videos.
Reporter Qie Niangao
20200708

No comments:

Post a Comment

Calendar



Park Plaza Hotel

Park Plaza Hotel
Please visit our Sponsor!

Luxury Living in Bay City


Park Plaza residents enjoy beautiful views, fine dining, and a roof top patio with hot tub; all this near route 66, and within walking distance to Hairy Hippo Fun Land and aquarium. Rates start at 55L a week for studios, and 185L a week for full size apartments. Free furnishings available. Contact Roc Plutonium for more information!

Archive