How do I pause/play/seek a silverlight video using javascript -


a little bit of context. want able programmatically control silverlight video player on amazon instant video javascript.

using developer console. have found video player element in dom.

<div id="player_container" style="display: block;">   <object type="application/x-silverlight"            data="data:application/x-silverlight,"            id="player_object"            width="50%"            height="100%">     <param name="color" value="#ffffff">     <param name="background" value="#000000">     <param name="minruntimeversion" value="5.1">     <param name="autoupgrade" value="false">     ... elided several <param>'s here ...   </object> </div> 

i enter following in js repl in developer console:

 > var silver = document.getelementbyid("player_object"); 

i attempting follow instructions found here. state should,

 > silver.content.findname(something_here); 

i unsure use something_here, downloaded silverlight app

wget http://www.amazon.com/gp/video/streaming/silverlightplayer.xap?ie=utf8&version=104.0-0 unzip silverlightplayer.xap?ie=utf8 

i in unzipped appmanifest.xaml:

<deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" externalcallersfromcrossdomain="scriptableonly" entrypointassembly="amazon.atvsilverlightplayer" entrypointtype="amazon.atvsilverlightwebplayer.app" runtimeversion="5.0.61118.0">   <deployment.parts>     <assemblypart x:name="amazon.atvsilverlightplayer" source="amazon.atvsilverlightplayer.dll" />     <assemblypart x:name="amazon.aiv.utilities" source="amazon.aiv.utilities.dll" />     <assemblypart x:name="amazon.common" source="amazon.common.dll" />     <assemblypart x:name="amazonplayer.themes.darkgray" source="amazonplayer.themes.darkgray.dll" />     <assemblypart x:name="atvadsmanager" source="atvadsmanager.dll" />     <assemblypart x:name="atvqos" source="atvqos.dll" />     <assemblypart x:name="microsoft.logging.localconnection" source="microsoft.logging.localconnection.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.core" source="microsoft.silverlightmediaframework.core.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.diagnostics" source="microsoft.silverlightmediaframework.diagnostics.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.logging" source="microsoft.silverlightmediaframework.logging.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.plugins" source="microsoft.silverlightmediaframework.plugins.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.plugins.monitoring" source="microsoft.silverlightmediaframework.plugins.monitoring.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.plugins.progressive" source="microsoft.silverlightmediaframework.plugins.progressive.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.plugins.smoothstreaming" source="microsoft.silverlightmediaframework.plugins.smoothstreaming.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.plugins.timedtext" source="microsoft.silverlightmediaframework.plugins.timedtext.dll" />     <assemblypart x:name="microsoft.silverlightmediaframework.utilities" source="microsoft.silverlightmediaframework.utilities.dll" />     <assemblypart x:name="microsoft.web.media.smoothstreaming" source="microsoft.web.media.smoothstreaming.dll" />     <assemblypart x:name="newtonsoft.json" source="newtonsoft.json.dll" />     <assemblypart x:name="system.json" source="system.json.dll" />     <assemblypart x:name="system.xml.linq" source="system.xml.linq.dll" />     <assemblypart x:name="system.componentmodel.composition" source="system.componentmodel.composition.dll" />     <assemblypart x:name="system.xml.serialization" source="system.xml.serialization.dll" />     <assemblypart x:name="system.componentmodel.composition.initialization" source="system.componentmodel.composition.initialization.dll" />     <assemblypart source="de/amazon.atvsilverlightplayer.resources.dll" />     <assemblypart source="en-gb/amazon.atvsilverlightplayer.resources.dll" />     <assemblypart source="ja/amazon.atvsilverlightplayer.resources.dll" />     <assemblypart source="de/system.json.resources.dll" />     <assemblypart source="ja/system.json.resources.dll" />     <assemblypart source="de/system.xml.linq.resources.dll" />     <assemblypart source="ja/system.xml.linq.resources.dll" />     <assemblypart source="de/system.componentmodel.composition.resources.dll" />     <assemblypart source="ja/system.componentmodel.composition.resources.dll" />     <assemblypart source="de/system.xml.serialization.resources.dll" />     <assemblypart source="ja/system.xml.serialization.resources.dll" />     <assemblypart source="de/system.componentmodel.composition.initialization.resources.dll" />     <assemblypart source="ja/system.componentmodel.composition.initialization.resources.dll" />   </deployment.parts> </deployment> 

i have tried substituting many of x:name values found in .xaml file something_here when using silver.content.findname(something_here). returns null. want handle lets me play/pause/seek amazon instant video own javascript console? how should procceed?

the app manifest not actual silverlight application, defines assemblies in xap file make silverlight application. silverlight mediaelement trying access defined in xaml file contained in 1 of dll's listed in app manifest, amazon.atvsilverlightplayer.dll start looking. .net reflector inspecting dlls.

referencing mediaelement name fragile approach assigning x:name attribute silverlight elements optional , amazon change @ point. traverse silverlight app visual tree , objects of type mediaelement following approach described here: javascript array of textblock elements xaml file

i had change working me:

    var hasloaded = false;      function onsilverlightload(sender) {         if (hasloaded) {             return;         }         foreachdescendant(document.getelementbyid('silverlightobject').content.root);         hasloaded = true;     }      function foreachdescendant(elem) {         if (elem != null) {             console.log('type: ' + elem.tostring());             if (typeof elem.children == 'object') {                 (var = 0; < elem.children.count; i++) {                     var child = elem.children.getitem(i);                     foreachdescendant(child);                 }             }             else if (typeof elem.content == 'object') {                 foreachdescendant(elem.content);             }         }     } 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -