I want to play dailymotion and youtube videos in my UIWebView control. And I'm using following embedded html code to play and it's working fine. But as device is being rotate, it's not resetting accordingly and if I call the following code again it will start to play video from beginning.
NSString* embedHTML = @"<html><head><style>body {\"background-color:transparent;color:black;\"}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\"type=\"application/x-shockwave-flash\"width=\"%.0f\" height=\"%.0f\"></embed></body></html>";
NSString* html = [NSString stringWithFormat:embedHTML, url, frame.size.width, frame.size.height];
Any solution that reset my view according to the device rotation and continue playing without restarting..?
EDIT: Video is changing orientation perfectly in playing mode. Once I have stopped it and trying to rotate view, the webview's content does not rotating. And I am looking for the solution of that.
You can integrate the following code: http://www.mightymeta.co.uk/embedding-youtube-within-iphone-apps/
I had made a tutorial for this and where it is working with interface orienatation changes also.
Here is the implementation file. Just copy paste into your controller,put your URL and try this code
Here is the header file for the ViewController
Hope this helps you.
If you require more help then please let me know.
EDIT: This code most probably wont work properly on simulator as simulator doesnt have a shockwave- flash player