Question

In my cocoa apps for OSX 10.6 and newer versions I've always used this code to embed a video from youtube:

NSString *html = @"<center><iframe width=\"748\" height=\"461\" src=\"http://www.youtube.com/embed/SV1cVDhKZ6g?rel=0\" frameborder=\"0\" allowfullscreen></iframe></center>";

  [[videoView mainFrame] loadHTMLString:html baseURL:nil];

but now it is not working anymore, it just appears a black window and if I click on it I can still hear audio from video but no image anymore... I'm using Maverick and Xcode 5... Anyone knows what can be the problem? Thanks for any help. Massy

update: I'm also noticing that if I double click on video frame to see it fullscreen the video appears... but when I double click again to make it framed in my app the image of the video disappears again

update 2: As pointed by ThisDarkTao I can now say this is a problem concerning Safari's Flash sandbox. I tryed the solution by this post:

Flash videos in WebView not working in sandboxed app

but it didn't work at all...

During my research I read somewhere that someone says this must be a bug... I'm not so sure about it... I think this is exactly what Apple wants... finally flash is always been a bad topic for guys at Cupertino... isn't it?

I'm sure there must be a solution to this....

If anyone knows a better solution please write it... If none will give a better solution I will accept the answer of ThisDarkTao as it seams for now is the only way to make it work.

Was it helpful?

Solution

It looks like this is a problem concerning Safari's Flash sandbox. I have the same problem on a Mavericks app I'm developing at the moment. I added html5=1 to the video arguments list, effectively forcing HTML5 video.

Yours in that case would be:

NSString *html = @"<center><iframe width=\"748\" height=\"461\" src=\"http://www.youtube.com/embed/SV1cVDhKZ6g?rel=0&html5=1\" frameborder=\"0\" allowfullscreen></iframe></center>";

If you definitely need Flash, I haven't been able to find a more elegant solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top