Discussion Forums  >  Uncategorized

Replies: 4    Views: 317

appvision
Aspiring developer
Profile
Posts: 139
Reg: Jan 20, 2011
location unknow...
1,390
04/19/11 01:23 PM (14 years ago)

Link to Video included in Xcode

How do I link from a custom HTML page to a Video that is included in Xcode? Thanks.
 
appvision
Aspiring developer
Profile
Posts: 139
Reg: Jan 20, 2011
location unknow...
1,390
like
04/19/11 01:24 PM (14 years ago)
I'm using v 1.5.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
04/19/11 01:44 PM (14 years ago)
Hmm... an HTML link is best used by loading another HTML document. There are ways to trigger an Objective C / buzztouch method (like a menu tap does) but it's more complex than most folks understand. a) Make two HTML documents. One holding the link, the other holding the video. Drag both of these into the BT_Docs folder in your Xcode project. Use the sample.html document in the BT_Docs folder as a starting point if you want. b) In the second HTML page, use very simple HTML5 markup to add the video. iOS will handle this well for a good end-user experience. See this URL for info about how to do the HTML5 markup to embed the video: http://camendesign.com/code/video_for_everybody There are lots and lots of examples of this online, this is only one.
 
appvision
Aspiring developer
Profile
Posts: 139
Reg: Jan 20, 2011
location unknow...
1,390
like
04/19/11 02:21 PM (14 years ago)
I'd like to try the Objective C / buzztouch method (like a menu tap does); can you point me in the right direction? Thanks very much David!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
04/19/11 03:08 PM (14 years ago)
The idea is that you 'trap' or 'detect' the link that was clicked. Then, based on what you learn about the link, you either continue loading the webpage it linked to, or, stop and do something else. To do this you format the html links in a way that will allow you to 'detect' them when they are clicked. For every click, some UIWebViewDelegate methods are called. In this case, we'll want to pay special attention to the shouldStartLoadWithRequest method. Have a look at that method in the BT_screenCustomURL.m or BT_screenCustomHTML.m files in the project download. Take some time to review that method. You'll see where some information about 'what was clicked' is being processed. Example...if the link that was clicked had a URl (href) that includes a Google Maps url, it wont' load but instead fire another method to ask the user if they want to open the native maps app. So.... in order for you to customize the behavior of an HTML link, you'll need to first create some links that are 'different' than the other links. Then, when one of these links is clicked, you can catch it in the shouldStartLoadWithRequest, not continue, and trigger some other event - like a custom playMyVideo method or whatever. See if you can get this far then nudge this thread if you get somewhere...or get stuck... of course Google's pretty smart too. Try a Google search for Call Objective C method from HTML for dozens of tips, articles, etc.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.