Help with site config

I’ve been playing around now for about a month with a site configuration file that requires me to authenticate to access the content. I think i’m very close as I can see from the log files that it’s correctly accessing the login url and submitting the appropriate username/password. It’s also re-directing back to the original URL and I can hear the appropriate audio for the stream. However, Plex is not finding/displaying the appropriate video and is simply displaying a random part of a page (which I don’t recognise). I’ve attached a photo:







Does anyone know what this is and how to resolve this? The page i’m trying to use contains Silverlight if that’s any help. Also, here’s my current Site Config:



<br />
<state name="check_for_login"><br />
	<event><br />
        	<condition><br />
            	<frameLoaded /><br />
			</condition><br />
			<br />
        	<action><br />
        		<visit url="https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do"/><br />
        		<goto state="login"/><br />
        	</action><br />
    	</event><br />
</state><br />
	<br />
<state name="login"><br />
	<event><br />
        	<condition><br />
            	       <frameLoaded /><br />
		</condition><br />
			<br />
        	<action><br />
        		<run script="function logMeIn(){document.login.userName.value='${username}';document.login.password.value='${password}';document.login.onsubmit();}"/><br />
        		<run script="logMeIn();"/><br />
        		<pause time="5000" /><br />
    			<visit url="${url}" /><br />
			<goto state="playing" /><br />
        	</action><br />
    	</event><br />
</state><br />
	<br />
<state name="playing"><br />
	<event><br />
        	<condition><br />
			<javascript script="true ? 1 : 0" matches="1" /><br />
		</condition><br />
			<br />
        	<action><br />
        		<!-- Do Nothing --><br />
        	</action><br />
    	</event><br />
</state><br />


Hi there! Can you post the entire site config file for us to have a look?



Yeah, of course:


<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://skyplayer.sky.com"<br />
	plugin="silverlight"<br />
	initialState="check_for_login"<br />
	version="1.0"<br />
	identifier="com.plexapp.plugins.skyplayer"<br />
	agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-gb) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16"<br />
    windowHeight="720" <br />
    windowWidth="1280"><br />
        		<br />
    <!-- Loading --><br />
	<state name="check_for_login"><br />
		<event><br />
        	<condition><br />
            	<frameLoaded /><br />
			</condition><br />
			<br />
        	<action><br />
        		<visit url="https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do"/><br />
        		<goto state="login"/><br />
        	</action><br />
    	</event><br />
	</state><br />
	<br />
	<state name="login"><br />
		<event><br />
        	<condition><br />
            	<frameLoaded /><br />
			</condition><br />
			<br />
        	<action><br />
        		<run script="function logMeIn(){document.login.userName.value='${username}';document.login.password.value='${password}';document.login.onsubmit();}"/><br />
        		<run script="logMeIn();"/><br />
        		<pause time="5000" /><br />
    			<visit url="${url}" /><br />
				<goto state="playing" /><br />
        	</action><br />
    	</event><br />
	</state><br />
	<br />
	<!-- Playing --><br />
	<state name="playing"><br />
		<event><br />
        	<condition><br />
				<javascript script="true ? 1 : 0" matches="1" /><br />
			</condition><br />
			<br />
        	<action><br />
        		<!-- Do Nothing --><br />
        	</action><br />
    	</event><br />
	</state><br />
	<br />
</site><br />




It seems that the output has slightly changed this morning. I'm now receiving a blank (kinda yellow) screen within Plex. The same colour as the border of the previous image. I've examined the log files and it appears as if it's doing the right thing. I don't really understand why is says it's finding two silverlight controls while loading the page (Xaml1 and silverlightControl). I've looked at the page using Google Chrome and the silverlightControl is the proper control that should be extracted. Plex is also starting to display the strange yellow image before the log says that it's browsing back to the proper URL. Has it found the wrong silverlight component in some way?


<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG - Request: GET /video/:/webkit?url=http%3A%2F%2Fskyplayer.sky.com%2Fvod%2Fpage%2FplayLiveTv.do%3FepgChannelId%3D1301&prefix=/video/skyplayer [::ffff:127.0.0.1] (1 live)<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG -  * url => http://skyplayer.sky.com/vod/page/playLiveTv.do?epgChannelId=1301<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG -  * prefix => /video/skyplayer<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG - WebKit: [skyplayer.sky.com/vod/page/playLiveTv.do?epgChannelId=1301]<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG - Found corresponding plug-in: /Users/IanDBird/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.plugins.skyplayer<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG - Resetting to state check_for_login<br />
Apr 04, 2011 07:54:46 [0xb0cbb000] DEBUG - Using /Users/IanDBird/Library/Application Support/Plex Media Server/Plug-ins/SkyPlayer.bundle/Contents/Site Configurations/skyplayer.xml with score of 24.<br />
Apr 04, 2011 07:54:46 [0xb0ab3000] DEBUG - LINE: HELLO<br />
Apr 04, 2011 07:54:49 [0xa06ef540] DEBUG - Received title [Watch Live TV Online | Sky Player].<br />
Apr 04, 2011 07:54:49 [0xa06ef540] DEBUG - Received title [Blank Document].<br />
Apr 04, 2011 07:54:49 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:54:49 [0xa06ef540] DEBUG - Executing Visiting https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do<br />
Apr 04, 2011 07:54:49 [0xa06ef540] DEBUG - Browsing to URL: https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do<br />
Apr 04, 2011 07:54:49 [0xa06ef540] DEBUG - Stopping execution, waiting for 1<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Executing Moving to state login<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Executing Javascript(function logMeIn(){document.login.userName.value='${username}';document.login.password.value='${password}';document.login.onsubmit();})<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Executing Javascript(logMeIn();)<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Executing Pausing 5000ms<br />
Apr 04, 2011 07:54:59 [0xa06ef540] DEBUG - Stopping execution, waiting for 2<br />
Apr 04, 2011 07:55:01 [0xa06ef540] DEBUG - 0x27da930 Plugin loaded [data:application/x-silverlight,] (0 0 300 300 Xaml1)<br />
Apr 04, 2011 07:55:01 [0xa06ef540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 04, 2011 07:55:01 [0xa06ef540] DEBUG - Got a URL, was waiting for something else.<br />
Apr 04, 2011 07:55:01 [0xa06ef540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 04, 2011 07:55:02 [0xa06ef540] DEBUG - Initializing shared memory 300 x 300<br />
Apr 04, 2011 07:55:04 [0xa06ef540] DEBUG - Timer Expired.<br />
Apr 04, 2011 07:55:04 [0xa06ef540] DEBUG - Executing Visiting ${url}<br />
Apr 04, 2011 07:55:04 [0xa06ef540] DEBUG - Browsing to URL: http://skyplayer.sky.com/vod/page/playLiveTv.do?epgChannelId=1301<br />
Apr 04, 2011 07:55:04 [0xa06ef540] DEBUG - Stopping execution, waiting for 1<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - Executing Moving to state playing<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - 0x31db6c0 Plugin loaded [data:application/x-silverlight,] (0 0 300 300 Xaml1)<br />
Apr 04, 2011 07:55:06 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Received title [Blank Document].<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Frame was loaded.<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - 0x1952e830 Plugin loaded [data:application/x-silverlight,] (129 227 750 421 silverlightControl)<br />
Apr 04, 2011 07:55:07 [0xa06ef540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />




I'd really appreciate if you could have a look at this.
Thanks in advance!

I’ve put together a slightly modified version of my plugin. Although all of the proper live streams require authentication, there is also a valid test URL which can be accessed (http://skyplayer.sky.com/vod/page/detachedSampleStream.do). If you launch the plugin, you should be able to attempt to play the test URL via the (Test Channel) option. By default, the Site Configuration will attempt to redirect to the login url, post your credentials (which can be none since you dont need it to succeed) and then redirect back to the original URL. I’ve found that if the Site Configuration performs this multiple redirect, the end result fails. However, if you change the initialState of the Site Config to go straight to “playing”, then the test URL works well. I can only assume it’s something to do with this login redirect that i’m having to do and using silverlight.



Also, i’ve noticed that i’m doing something slightly different to most plugins where I am using javascript to programmatically call the onSubmit method of the document, instead of a simply jQuery.post. This is because I don’t know the post data up front and the onSubmit populates it with various things (including a unique identifier of the machine in order to restrict the number of machines that can be tied to a specific user account).

Anyone had a chance to have a look at this? or even got any suggestions about different things to try?

I am working on something similar for MLB.com. I’ll put upy siteconfig (not working) tonight with the errors I am getting in PMS.log

Hi!

Just looked at the code, I think there are a couple more things that need to be changed, but one thing that certainly won’t work is this:


document.login.onsubmit();


onsubmit() should be submit():

document.login.submit();

Here is a basic Site Config skeleton that can be used for sites that require a login inside a.



<site site="..."<br />
	plugin="..."<br />
	identifier="com.plexapp.plugins...."<br />
	initialState="wait-for-frame-load"<br />
	version="1.0"><br />
<br />
	<crop x="..." y="..." width="..." height="..." /><br />
<br />
	<seekbar type="..."><br />
		...<br />
		...<br />
	</seekbar><br />
<br />
	<!-- The condition we use several times from within states to check if we're logged in or not --><br />
	<condition name="need-to-login"><br />
		<and><br />
			<!-- Check if a specific element exists in the page, for example the loginform --><br />
			<!-- Returns true if we need to login --><br />
			<javascript script="login = document.getElementById('loginform') == null ? 1 : 0" matches="0" /><br />
		</and><br />
	</condition><br />
<br />
	<state name="wait-for-frame-load"><br />
		<event><br />
			<condition><br />
				<!-- Wait for the DOM to load... --><br />
				<frameLoaded /><br />
			</condition><br />
			<action><br />
				<!-- ...then goto the 'check-for-auth' state --><br />
				<goto state="check-for-auth" /><br />
			</action><br />
		</event><br />
	</state><br />
<br />
	<state name="check-for-auth"><br />
		<event><br />
			<condition><br />
				<!-- If we don't need to login, goto state 'playing' --><br />
				<not><br />
					<condition name="need-to-login" /><br />
				</not><br />
			</condition><br />
			<action><br />
				<goto state="playing" /><br />
			</action><br />
		</event><br />
		<event><br />
			<!-- If we *do* need to login, fill in the form and post it --><br />
			<condition><br />
				<condition name="need-to-login" /><br />
			</condition><br />
			<action><br />
				<run script="..........;" /><br />
				<!-- Wait a little bit, might not always be necessary, but it can never hurt (or break) anything --><br />
				<pause time="5000" /><br />
<br />
				<!-- Not 100% sure what happens when you submit the HTML-form instead of using XHR/jQuery --><br />
				<!-- Go to the page with the video (which is the url we sent to Webkit) --><br />
				<visit url="${url}" />                <!-- State machine will remain in the current state until this url has been loaded... --><br />
				<goto state="check-for-auth-again" /> <!-- ...then it will go to the 'check-for-auth-again' state. This is why the 'check-for-auth-again' shouldn't have a <frameLoaded/> condition --><br />
			</action><br />
		</event><br />
	</state><br />
<br />
	<state name="check-for-auth-again"><br />
		<event><br />
			<condition><br />
				<!-- If login was successful we should now not need to login and can go to the state 'playing' --><br />
				<not><br />
					<condition name="need-to-login" /><br />
				</not><br />
			</condition><br />
			<action><br />
				<goto state="playing" /><br />
			</action><br />
		</event><br />
		<event><br />
			<condition><br />
				<!-- If we still need to login after we've tried to login, something is wrong... --><br />
				<condition name="need-to-login" /><br />
			</condition><br />
		<action><br />
			<goto state="end" param="Please check your username and password in the plugin's settings" /><br />
		</action><br />
		</event><br />
	</state><br />
<br />
	...<br />
	...<br />
	...<br />
	...<br />
</site>

Hey Sander, really appreciate you taking a look at this. I’ll hopefully get time in the next day or two to try fleshing out the skeleton site config. Will hopefully sort out my remaining issues.

I finally got some time to re-write the Site Configuration (again :)) as suggested Sander1. I came up with the following:



<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://skyplayer.sky.com"<br />
    plugin="silverlight"<br />
    identifier="com.plexapp.plugins.skyplayer"<br />
    initialState="wait-for-frame-load"<br />
    version="1.0"><br />
    <br />
    <!-- The condition we use several times from within states to check if we're logged in or not --><br />
    <condition name="need-to-login"><br />
        <and><br />
            <!-- Check if a specific element exists in the page, for example the loginform --><br />
            <!-- Returns true if we need to login --><br />
            <javascript script="document.cookie.indexOf('; skySSO=')" matches="-1" /><br />
        </and><br />
    </condition><br />
    <br />
    <state name="wait-for-frame-load"><br />
        <event><br />
            <condition><br />
                <!-- Wait for the DOM to load... --><br />
                <frameLoaded /><br />
            </condition><br />
            <action><br />
                <!-- ...then goto the 'check-for-auth' state --><br />
                <goto state="check-for-auth" /><br />
            </action><br />
        </event><br />
    </state><br />
    <br />
    <state name="check-for-auth"><br />
        <event><br />
            <condition><br />
                <!-- If we don't need to login, goto state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
        <event><br />
            <!-- If we *do* need to login, fill in the form and post it --><br />
            <condition><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
                <visit url="https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do"/><br />
                <goto state="login"/><br />
            </action><br />
        </event><br />
    </state><br />
    <br />
    <state name="login"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
				<run script="page='${url}';index=page.indexOf('/page/');document.login.userName.value='${username}';document.login.password.value='${password}';document.login.nextUrl.value=page.substring(index);document.login.submit();" /><br />
                <pause time="5000" /><br />
                <visit url="${url}" /><br />
                <goto state="check-for-auth-again" /><br />
            </action><br />
        </event><br />
    </state><br />
    <br />
    <state name="check-for-auth-again"><br />
        <event><br />
            <condition><br />
                <!-- If login was successful we should now not need to login and can go to the state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
        <event><br />
            <condition><br />
                <!-- If we still need to login after we've tried to login, something is wrong... --><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
                <goto state="end" param="Please check your username and password in the plugin's settings" /><br />
            </action><br />
        </event><br />
    </state><br />
    <br />
    <!-- Playing --><br />
    <state name="playing"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
			<br />
            <action><br />
                <!-- Do Nothing --><br />
            </action><br />
        </event><br />
    </state><br />
    <br />
</site><br />




However, this is still causing the exact same problem as mentioned above. It seems that the Plex framework is identifying an unknown sliverlight component (Xaml1) and displaying that instead of the correct one (silverlightControl). Here's the log:


<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Received title [Sky Player].<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Frame was loaded.<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Executing Moving to state check-for-auth<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Executed 'document.cookie.indexOf('; skySSO=')' and now seeing if [-1] matches [-1]<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Executed 'document.cookie.indexOf('; skySSO=')' and now seeing if [-1] matches [-1]<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Executing Visiting https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Browsing to URL: https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do<br />
Apr 13, 2011 22:07:35 [0xa0a75540] DEBUG - Stopping execution, waiting for 1<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Frame was loaded.<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Executing Moving to state login<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Executing Javascript(page='${url}';nextPageIndex=page.indexOf('/page');document.login.userName.value='${username}';document.login.password.value='${password}';document.login.nextUrl.value=page.substring(nextPageIndex);document.login.submit();)<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Executing Pausing 5000ms<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Stopping execution, waiting for 2<br />
Apr 13, 2011 22:07:36 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - 0x16a3e670 Plugin loaded [data:application/x-silverlight,] (0 0 300 300 Xaml1)<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got a URL, was waiting for something else.<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - Got frame loaded, was waiting for something else.<br />
Apr 13, 2011 22:07:39 [0xa0a75540] DEBUG - Initializing shared memory 300 x 300<br />
Apr 13, 2011 22:07:41 [0xa0a75540] DEBUG - Got a URL, was waiting for something else.<br />
Apr 13, 2011 22:07:41 [0xa0a75540] DEBUG - Plug-in changed frame size to 300 x 300<br />
Apr 13, 2011 22:07:41 [0xa0a75540] DEBUG - Initializing shared memory 300 x 300<br />
Apr 13, 2011 22:07:47 [0xa0a75540] DEBUG - Timer Expired.<br />
Apr 13, 2011 22:07:49 [0xa0a75540] DEBUG - Frame was loaded.<br />
Apr 13, 2011 22:07:49 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:07:49 [0xa0a75540] DEBUG - Executing Javascript(page='${url}';nextPageIndex=page.indexOf('/page');document.login.userName.value='${username}';document.login.password.value='${password}';document.login.nextUrl.value=page.substring(nextPageIndex);document.login.submit();)<br />
Apr 13, 2011 22:07:49 [0xa0a75540] DEBUG - Executing Pausing 5000ms<br />
Apr 13, 2011 22:07:49 [0xa0a75540] DEBUG - Stopping execution, waiting for 2<br />
Apr 13, 2011 22:07:54 [0xa0a75540] DEBUG - Timer Expired.<br />
Apr 13, 2011 22:07:54 [0xa0a75540] DEBUG - Executing Visiting ${url}<br />
Apr 13, 2011 22:07:54 [0xa0a75540] DEBUG - Browsing to URL: http://skyplayer.sky.com/vod/page/detachedSampleStream.do<br />
Apr 13, 2011 22:07:54 [0xa0a75540] DEBUG - Stopping execution, waiting for 1<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Frame was loaded.<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executing Moving to state check-for-auth-again<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executed 'document.cookie.indexOf('; skySSO=')' and now seeing if [480] matches [-1]<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executing Moving to state playing<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executed 'document.cookie.indexOf('; skySSO=')' and now seeing if [480] matches [-1]<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - 0x16a845d0 Plugin loaded [data:application/x-silverlight,] (0 0 1024 698 silverlightControl)<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:00 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:00 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:02 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:02 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:02 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:02 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:03 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:04 [0xa0a75540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
Apr 13, 2011 22:08:07 [0xb0a31000] DEBUG - LINE: STOP<br />
Apr 13, 2011 22:08:07 [0xb0a31000] DEBUG - Stream closed.<br />
Apr 13, 2011 22:08:07 [0xb0a31000] DEBUG - Stream closed.<br />




As you can see from the log, there is the following line:

<br />
Apr 13, 2011 22:07:38 [0xa0a75540] DEBUG - 0x16a3e670 Plugin loaded [data:application/x-silverlight,] (0 0 300 300 Xaml1)<br />




This appears to be received from the URL and displayed showing the random Clear/Refresh buttons in my first posting. However, a little later on, it manages to find the correct silverlight control:

<br />
Apr 13, 2011 22:07:55 [0xa0a75540] DEBUG - 0x16a845d0 Plugin loaded [data:application/x-silverlight,] (0 0 1024 698 silverlightControl)<br />




This means that if you simply wait, you can hear the audio but not see any video. Any ideas?

I think i’ve narrowed down it slightly. It appears that the authentication is definitely working but when the “submit()” redirects to the original URL the page doesn’t seem to be very friendly to Plex. If I quite out, and then re-select the list item, I find that the Site Configuration will bypass the login stage and attempt to load the URL directly. This leads to the same result of the wrong thing being displayed but the audio working. I’ve examined the source of the page but doesn’t seem to be any other Silverlight control. Any suggestions to narrow this down would be gratefully received.

try this



<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://skyplayer.sky.com"<br />
    plugin="silverlight"<br />
    identifier="com.plexapp.plugins.skyplayer"<br />
    initialState="wait-for-frame-load"<br />
    version="1.0" manualLock="true"><br />
    



and


<br />
    <state name="check-for-auth-again"><br />
        <event><br />
            <condition><br />
                <!-- If login was successful we should now not need to login and can go to the state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="pre-playing" /><br />
            </action><br />
        </event>



and


<br />
    <state name="pre-playing"><br />
        <event><br />
            <condition><br />
                 <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
                <lockPlugin/><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
     </state>

Hi!

There’s no need to add another state, but it’s certainly worth to try and see if manual locking fixes the problem:



[list]Add manualLock to the site tag:


manualLock="true"


[*]Add *lockPlugin* just before the *goto state="playing"* commands in your site config:

<lockPlugin /><br />
<goto state="playing" />


[/list]

Thanks for your suggestions, unfortunately, no luck :frowning:



I did however stumble across the HTML from the web page which is the source of my random page as seen from my first post:


<br />
    <iframe name="slpCountTracker" height="1" width="1" frameborder="0" scrolling="no" style="position: absolute; right:0; bottom:0"></iframe><br />
            <iframe name="slpCountTracker2" height="1" width="1" frameborder="0" scrolling="no" src="http://skyplayer.sky.com/SVOD/COMMON/STATICPAGES/COUNTTRACK/track2.html" style="position: absolute; right:1px; bottom:0"></iframe><br />




The iframe does not actually appear to be anything visible. The main silverlight control is contained within a separate div with an id of "aazone.mainpage". Does any of this make any sense? I think i'm completely out of my depth now. Has anyone come across anything similar? A few things I can think of:
[list]
[*]First of all, why is it navigating to that page at all? It appears nothing actually refers to it
[*]If the plugin is locked, could I modify the HTML is the document to remove this? Then I could unlock it and hope that it finds the other silverlight control.
[/list]

I tried a little hack in the pre-playing to strip out all of the html apart from the needed silverlight control. Didn't seem to work and still showed me the crappy Xaml1. ARG!


<br />
    <state name="pre-playing"><br />
        <event><br />
            <condition><br />
                <frameLoaded /><br />
            </condition><br />
            <action><br />
                <run script="document.body = silverlightControl"/><br />
                <lockPlugin/><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
     </state><br />




Very nice find! It appears that inside one of those iframes another Silverlight element is loaded, the one you were seeing inside Plex:

http://img849.imageshack.us/img849/2301/screenshot20110415at020.png




Although the iframe is not visible inside the page, it is included in the code. PMS is just loading the website as if it's loaded in Safari. That's why the contents of the iframe(s) is loaded too.

I've come across something similar before where the contents of an iframe caused problems. The simple solution is to use javascript to edit the contents of the webpage from within the site config. I'll post an updated site config in a few seconds.

<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://skyplayer.sky.com"<br />
    plugin="silverlight"<br />
    identifier="com.plexapp.plugins.skyplayer"<br />
    initialState="wait-for-frame-load"<br />
    manualLock="true"<br />
    version="1.0"><br />
<br />
    <!-- The condition we use several times from within states to check if we're logged in or not --><br />
    <condition name="need-to-login"><br />
        <and><br />
            <!-- Check if a specific element exists in the page, for example the loginform --><br />
            <!-- Returns true if we need to login --><br />
            <javascript script="document.cookie.indexOf('; skySSO=')" matches="-1" /><br />
        </and><br />
    </condition><br />
<br />
    <state name="wait-for-frame-load"><br />
        <event><br />
            <condition><br />
                <!-- Wait for the DOM to load... --><br />
                <frameLoaded /><br />
            </condition><br />
            <action><br />
                <!-- ...then goto the 'check-for-auth' state --><br />
                <goto state="check-for-auth" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="check-for-auth"><br />
        <event><br />
            <condition><br />
                <!-- If we don't need to login, goto state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
        <event><br />
            <!-- If we *do* need to login, fill in the form and post it --><br />
            <condition><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
                <visit url="https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do"/><br />
                <goto state="login"/><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="login"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
                <run script="page='${url}';index=page.indexOf('/page/');document.login.userName.value='${username}';document.login.password.value='${password}';document.login.nextUrl.value=page.substring(index);document.login.submit();" /><br />
                <pause time="5000" /><br />
                <visit url="${url}" /><br />
                <goto state="check-for-auth-again" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="check-for-auth-again"><br />
        <event><br />
            <condition><br />
                <!-- If login was successful we should now not need to login and can go to the state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
        <event><br />
            <condition><br />
                <!-- If we still need to login after we've tried to login, something is wrong... --><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
                <goto state="end" param="Please check your username and password in the plugin's settings" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <!-- Playing --><br />
    <state name="playing"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
                <!-- Find all iframe elements on the webpage and trash the contents of all of them by changing the 'src' attribute --><br />
                <run script="iframes = document.getElementsByTagName('iframe'); for (i=0; i&lt;iframes.length; i++){iframes*.src='';}" /><br />
                <pause time="1000" /><br />
                <!-- Lock onto the only(?) remaining Silverlight object --><br />
                <lockPlugin /><br />
                <!-- Done! We don't need to do anything else here --><br />
            </action><br />
        </event><br />
    </state><br />
<br />
</site><br />


Doesn’t that continuously unlock the plugin and the have that the plugin loaded some player over and over again? That is what happened to me at least when I tried to put in the playing state.

Good point, I’m not sure what happens when you use in the playing state. In this case introducing a new “intermediate” state should not be a problem (I called it “cleanup” in my updated config, see below):



<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://skyplayer.sky.com"<br />
    plugin="silverlight"<br />
    identifier="com.plexapp.plugins.skyplayer"<br />
    initialState="wait-for-frame-load"<br />
    manualLock="true"<br />
    version="1.0"><br />
<br />
    <!-- The condition we use several times from within states to check if we're logged in or not --><br />
    <condition name="need-to-login"><br />
        <and><br />
            <!-- Check if a specific element exists in the page, for example the loginform --><br />
            <!-- Returns true if we need to login --><br />
            <javascript script="document.cookie.indexOf('; skySSO=')" matches="-1" /><br />
        </and><br />
    </condition><br />
<br />
    <state name="wait-for-frame-load"><br />
        <event><br />
            <condition><br />
                <!-- Wait for the DOM to load... --><br />
                <frameLoaded /><br />
            </condition><br />
            <action><br />
                <!-- ...then goto the 'check-for-auth' state --><br />
                <goto state="check-for-auth" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="check-for-auth"><br />
        <event><br />
            <condition><br />
                <!-- If we don't need to login, goto state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="cleanup" /><br />
            </action><br />
        </event><br />
        <event><br />
            <!-- If we *do* need to login, fill in the form and post it --><br />
            <condition><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
                <visit url="https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do"/><br />
                <goto state="login"/><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="login"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
                <run script="page='${url}';index=page.indexOf('/page/');document.login.userName.value='${username}';document.login.password.value='${password}';document.login.nextUrl.value=page.substring(index);document.login.submit();" /><br />
                <pause time="5000" /><br />
                <visit url="${url}" /><br />
                <goto state="check-for-auth-again" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="check-for-auth-again"><br />
        <event><br />
            <condition><br />
                <!-- If login was successful we should now not need to login and can go to the state 'playing' --><br />
                <not><br />
                    <condition name="need-to-login" /><br />
                </not><br />
            </condition><br />
            <action><br />
                <goto state="cleanup" /><br />
            </action><br />
        </event><br />
        <event><br />
            <condition><br />
                <!-- If we still need to login after we've tried to login, something is wrong... --><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
                <goto state="end" param="Please check your username and password in the plugin's settings" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <!-- Cleanup --><br />
    <state name="cleanup"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
                <!-- Find all iframe elements on the webpage and trash the contents of all of them by changing the 'src' attribute --><br />
                <run script="iframes = document.getElementsByTagName('iframe'); for (i=0; i&lt;iframes.length; i++){iframes*.src='';}" /><br />
                <pause time="1000" /><br />
                <!-- Lock onto the only(?) remaining Silverlight object --><br />
                <lockPlugin /><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <!-- Playing --><br />
    <state name="playing"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
                <!-- Done! We don't need to do anything else here --><br />
            </action><br />
        </event><br />
    </state><br />
<br />
</site><br />


Guess what… it’s working! :smiley:



There was a few things that caused some issues,

[list]

[]I found that if the time pauses were too long, when they expired, it didn’t seem to move onto the next stage. For now, I just reduced the period of the pause.

[
]Instead of wiping the src’s of the iframes, I basically cleared the document and set it’s body to only contain the known silverlight control. Seemed to work well

[/list]



I really loved that as soon as I got this working, I was then able to watch all the Sky Sports channels, and MTV on my iPhone via Plex for iOS!!! I’ll hopefully get some time over the next few days to sort out some artwork/thumbnails. I’ll then release a pretty primitive version as soon as possible to see what people think.



Thanks again to both of you for your help. I definitely couldn’t have done it without you. If you’re ever in Scotland, I owe you a pint!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.