SDK Questions
I'm new to this, still trying to make my way. I think I've read all the threads, and Connunity too.
* There's is simply not enough example code in the SDK. The documentation is good as a reference manual, but there should be more applied examples.
* Is it possible to use playMediaEx to play WMV? Can someone point me to sample source for this?
* playMediaEx supports mimeTypes MPEG and AVI. Are there any other mimetypes added since that documentation was written?
* will Server 1.5 see any enhancements to the SDK, either new features, new documentation, etc?
* I've looked through a lot of CPI packages now, and almost all of them are based on Porfitron's indirect system for parsing RSS. Is it at all possible to parse content with Connected without being redirected to some intermediary web server? I'm trying to parse HTML, not RSS.
var pageUrl = "http://somewhere.com/page.html";
var pageXHR;
var contentId;
function handlePageResult(doc)
{
//do what you want in here...
//I used it to find a content_id in an HTML page
var fixURL1 = doc.split('content_id\", \"');
var fixURL2 = fixURL1[1].split('\")');
contentId = fixURL2[0];
var dctk = connected.toolkit;
connected.debug.print("content_id= "+contentId);
}
function startPageRequest()
{
pageXHR = new XMLHttpRequest();
pageXHR.onreadystatechange = onPageXHRStateChange;
pageXHR.open("GET", pageUrl, true);
//force to handle html as text/xml
pageXHR.overrideMimeType('text/xml');
pageXHR.send(null);
}
function onPageXHRStateChange()
{
if (pageXHR.readyState == 4)
{
if (pageXHR.status == 200)
{
handlePageResult(pageXHR.responseText);
}
}
}
Okay, another question...
Is that XMLHttpRequest() object asynchronous? Is it a seperate thread?
I was trying to use that form to populate an array that I wanted to use as a menu for a "rolling menu" and it appears that the rolling menu may not have actually had the array yet when I called it.
It's complaining about the Content-Type directive that the page sends out, it throws a "badly formed" error on this line:
[editing some spaces in because the board software was tossing my non-allowed tags]
< meta http-equiv=Content-Type content="text/html; charset=windows-1250" >
I suppose that's badly formed since the string argument to http-equiv isn't properly quoted. At least I know the page is being fetched! Maybe there's a non-XML way to read it?
Another thing...when it throws this error, I seem to have trouble after I modify my .zpi and try to reload it. It doesn't seem to load the plug-in anymore at all after that. I have to restart the server (which is running standalone, so it's not a big hardship.)
I'm getting it now, I just have to turn off your XML switch and it doesn't fuss.
So, I am parsing in a beautiful HTML file. I just haven't gotten the parse working fully yet, but I'm getting there. I got a lot of work to do the menus though. This might take me another few days at my slow rate!
I realize now that it's installing a new .ZPI version of plug-in that I have to restart. Not sure why exactly. Maybe I need to change something?
Here's the code for doing WMV playback:
var path = "http://somewhere.com/movie.wmv";
connected.playback.playMediaWithDriver(path, "divx.connected.playback.dshow");
The biggest SDK enhancements were probably taken care of in the 1.4 version, where you're able to mix DivX javascript and HTML content, which resulted in plug-ins pointing to HTML/FLash content.
More details about that are here:
http://labs.divx.com/node/6609
Feel free to post any other questions or samples requests.
How about an example if someone wants to playback .wmv or .divx files from an rss feed...without using the plug-in maker?
Here's an example of an RSS feed reader that parses the feed and plays its WMV: http://labs.divx.com/files/rss-wmv-example.zip
The issue is that many sites play around with the elements in their RSS feeds... they don't seem to stick to one standard, but most of the time, it's just matter of changing a few lines near the top of podcast.js.
You have to just inspect the RSS feed and see what each of the tags are called, and make the corresponding changes in the .JS.
Unzip this code to the plug-ins folder:
C:\Program Files\DivX\DivX Connected\Bin\DivX Connected\framework\plugins
Note that this is a different folder than the ones that get installed automatically, but I like using this one for development. Also note that this folder can get overwritten when you do server upgrades, so keep the stuff in here backed up.
The example RSS feed keeps the video URI here:
enclosure url="http://www.podtrac.com/pts/redirect.wmv?http://media.libsyn.com/media/askaninja/AANSD7.wmv" length="9110591" type="video/x-ms-wmv"
So make sure the JS file is pulling it like this:
path = new Array()
for (var i = 1; i <= results; i++){
path[i] = doc.evaluate("//item["+ i +"]/enclosure/@url", doc, NSResolver, XPathResult.STRING_TYPE, null).stringValue;
}




Porfitron,
Thanks a lot. I actually typed up a reply but I think my computer crashed before I ever hit send. I was surprised not to see it here.
This worked great for me as a test, and I hardcoded in the link and could watch the video (a foreign language newsfeed.) Now I need to figure out how to parse the HTML (not XML) page where I'm getting the feeds from so I can create links to them. Is that something I can do with that page object manipulator? I can I fetch a page as a string and parse it?
I hope to get good at this and post some plug-ins. I'm really excited about some of the ones I saw here (I liked the CANAL+ one a lot!)