Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > WebKit/JavaScript/Embded WMP question

WebKit/JavaScript/Embded WMP question
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
May 6, 2005, 06:20 PM
 
Okay, this will sound really complicated. I've got a wmv file being played in the embeded version on WMP inside of a Cocoa Application using WebKit. What I'd like to be able to do somehow is somehow interact with the properties of the movie from within my Cocoa Application. All I really want to be able to do is find out at what spot the movie is at and get updates when the user changes the play head to a different spot in the movie. My guess is that I'd need to to do some bridging between javascript and the embded WMP, but I'm not sure. In fact, this whole idea could be a pipe dream, but I'd love to be able to do it.

Thanks!
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
May 7, 2005, 07:36 AM
 
Okay, here's what I've been able to do so far. I added this to my html file:

Code:
<script type="text/javascript" language="JavaScript"> <!--// function getCurrentPosition() { return document.VIDEO.controls.currentPosition; } //-> </script>
The id of my object is VIDEO.

Then inside of my WebView sublcass, I have this code:

Code:
- (int)getCurrentPosition { return [[self stringByEvaluatingJavaScriptFromString:@"getCurrentPosition()"] intValue]; }
But this always returns 0.


Does anyway see what I'm doing wrong?
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
May 7, 2005, 07:02 PM
 
I guess I'm the only one hear that knows anything about my plight?

Anyway, here's what I've been able to accomplish:

Code:
<script type="text/javascript" language="JavaScript"> <!--// function getCurrentPosition() { return document.getElementById('VIDEO').CurrentPosition; } //-> </script>
This works only if I set the CurrentPosition parameter when I'm defining my embeded object. Unfortunately, the CurrentPosition field doesn't seem to be one that updates over time. A very disheartening problem I've run into is that I can't actually send any commands at all to the embedded object, like:

document.getElementById('Video').stop()

and

document.getElementById('Video').controls.stop()

and

document.getElementById('Video').getAttributeById( 'controls').stop()

all fail to stop the video.

This is the most frustrating programming problem I have ever had - period. Is there any good documentation on this stuff? Everything google tells me doesn't work
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
May 14, 2005, 09:36 AM
 
Damn, I found my answer:

Windows Media Player 9 for Mac OS X does not provide access to the plug-in object model by using script code
http://www.microsoft.com/windows/win...es/macicp.aspx

Why the hell not?!?!?

Gr...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:30 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2