Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-28-2009, 01:43 AM   #1 (permalink)
Totally Awesome Member
 
dnite's Avatar
 
Join Date: Dec 2008
Location: Aurora, IL
Age: 30
Posts: 54
Default Handle when UIWebView Media Player is done

I can't for the life of me figure out how to determine when a video or audio file is done after clicking a link in a UIWebView..

For instance, a user clicks a link to a video in a UIWebView in my app. The default media player launches and loads up the video. The video plays and finishes (or the user hits the Done button) .. Where do I go from here? Seems like a pretty big oversight if there's absolutely no way of handling this user interaction.

In my personal example, I'd love to be able to stop refreshing an ad while a video or audio file is being played in a UIWebView from my app so that it doesn't keep refreshing in the background while no user will ever see the ads. I can stop the ads from refreshing by detecting the filetype when a link is clicked, but I have no method of restarting the timer.

Any ideas?
dnite is offline   Reply With Quote
Old 01-27-2010, 05:41 PM   #2 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 59
Default

Did you ever have any luck with this?

Quote:
Originally Posted by dnite View Post
I can't for the life of me figure out how to determine when a video or audio file is done after clicking a link in a UIWebView..

For instance, a user clicks a link to a video in a UIWebView in my app. The default media player launches and loads up the video. The video plays and finishes (or the user hits the Done button) .. Where do I go from here? Seems like a pretty big oversight if there's absolutely no way of handling this user interaction.

In my personal example, I'd love to be able to stop refreshing an ad while a video or audio file is being played in a UIWebView from my app so that it doesn't keep refreshing in the background while no user will ever see the ads. I can stop the ads from refreshing by detecting the filetype when a link is clicked, but I have no method of restarting the timer.

Any ideas?
brianr is offline   Reply With Quote
Old 01-28-2010, 04:17 PM   #3 (permalink)
Totally Awesome Member
 
dnite's Avatar
 
Join Date: Dec 2008
Location: Aurora, IL
Age: 30
Posts: 54
Default

Quote:
Originally Posted by brianr View Post
Did you ever have any luck with this?
The closest I was able to find was error code 204. If you get that error, I've found that it's usually trying to open a video/audio file.. so I just set a variable in the webview:didFailLoadWithError method and then check for it in the webview:shouldStartLoadWithRequest method.. Kind of clunky and stupid, but that's the only way I've figured out so far.
dnite is offline   Reply With Quote
Old 01-28-2010, 06:22 PM   #4 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 622
Default

Quote:
Originally Posted by dnite View Post
I can't for the life of me figure out how to determine when a video or audio file is done after clicking a link in a UIWebView.
You can invoke the default MediaPlayer without opening a webview. In this case you know it's done by:
Code:
// Register to receive a notification when the movie has finished playing. 
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:) 
name:MPMoviePlayerPlaybackDidFinishNotification 
object:moviePlayer];
In situations where I do open media (e.g. mp3) in a webview, the Quicktime player appears for me automatically. When the file is finished playing, or when a user pushes the "Done" button that is shown by default, it just displays a screen with a play arrow on it for me. User can play the file again, or use the NavController to go back to the list.
DenVog is offline   Reply With Quote
Reply

Bookmarks

Tags
media player, uiwebview

Thread Tools
Display Modes

Posting 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



» Advertisements
» Online Users: 260
24 members and 236 guests
ADY, bookesp, chillyh, ckgni, dacapo, Dani77, Davey555, Desert Diva, glenn_sayers, HemiMG, JasonR, LEARN2MAKE, M.A.S., marshusensei, mer10, nobre84, prchn4christ, Raggou, Rudy, ryantcb, Speed, themathminister, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,765
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:36 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0