See my own answer, got it working!
I am using video.js to play videos on a website which will also have to work offline, hence the usage of flash is not possible. Since video.js uses a flash fallback, I wrote my very own.
In IE8 for instance and object is created:
<OBJECT codeBase="http://www.microsoft.com/Windows/MediaPlayer/" classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 width=660 height=418 type=application/x-oleobject>
<embed src="Videos/Aktionen_Coffee-Stop/Teaser_Coffee-Stop.wmv" type="application/x-mplayer2" enabled="1" showstatusbar="1" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="true" width="660" height="418" scale="tofit"></embed></OBJECT>
This works perfectly fine and the object renders a video player (windows media player i.e., resp. quicktime in older mac/safari versions).
Is there any way in JavaScript to make this video playing to stop, replay, fire an "ended" like event?
Edit: even when looking at these "docs" - how to freakin create a Player object? How can people create such a doc? Seriously MS...
Update
var wmp = $('#wmp').get(0);
setTimeout(function() {
console.log(wmp.Controls.currentPosition());
wmp.Stop();
}, 2000);
the wmp.stop()
will work, but wmp.Controls
or .controls
always throws an error. I just want to know when the video has ended.
Actionscript filter xml with variable
I've been tinkering for a while whit this problem, and hope someone gets what I'm Trying to do
I have an Xml file
<Results>
<Details>
<Id>1</Id>
</Details>
<StepResults>
<Step SeqNr="1">
<Value>10</Value
</Step>
<Step SeqNr="2">
<Value>100</Value
</Step>
</StepResults>
</Results>
Now I created a script where people can parse this dynamically, lets say someone would like to get the id of this Result he can add a variable in their backend like so: [Details.Id] and this will be parsed in actionscript and get the result from the xml.
I parse it like this:
var pattern:RegExp = /\[[A-Za-z\.0-9()=\[\]@]*\]/g;
var possibleVars:Array = str.match(pattern);
for each(var myVar:String in possibleVars){
//Remove the blockquotes from the var (this would be the [Details.Id])
var checkVar:String = myVar.substr(1,(myVar.length-2));
var result:String = dotSyntax(xmlToParse,checkVar);
}
private function dotSyntax(target:XML, path:String):String {
//Split the var into different pars
var level:Array=path.split(".");
var curr:* = target;
for (var i:int = 0; i<level.length; i++) {
if(i==0 && curr[level[i]].length() <= 0){
return "";
break;
}
//Try to go trough the xml with the supplied var
curr=curr[level[i]];
}
//return the value from the xml file (if all went well we have 1 here
return curr;
}
Now this really works like a charm, but I would like to give them the possibility to find values from the different steps, so normally to get this working in actionscript directly you would filter the xml like this (if you want the Value of step SeqNr=2):
resXml.StepResults.Step.(@SeqNr==2).Value
But I can't seem to get this to work with a dynamic variable. any pointers how I can do this using the dotSyntax function? (returning the value of step seqnr2)