Note that there are some explanatory texts on larger screens.

plurals
  1. PORead/write text file from javascript in objective-c project
    primarykey
    data
    text
    <p>I am making an app for iPhone and in that I am using Javascript for making making embeded youtube in UIWebView. I want to open/read/write a file on some events from javascript and then want to use that file in objective-c code. But how can I do this? I mean at what location can I save and open the file.</p> <p>I have made a file called youtubeAPI.html and calling this file from objective-c code. It opens the page successfully. Now I want to open a file and write the something everytime it changes it states, and then need to to show that file in the final result from obejective-c. Please tell me how can i do this.</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;body&gt; &lt;div id="player"&gt;&lt;/div&gt; &lt;script&gt; //Load player api asynchronously. var tag = document.createElement('script'); tag.src = "http://www.youtube.com/player_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var done = false; var player; function onYouTubePlayerAPIReady() { player = new YT.Player('player', { height: '390', width: '640', videoId: 'JW5meKfy3fY', events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } function onPlayerReady(evt) { evt.target.playVideo(); } function onPlayerStateChange(evt) { if (evt.data == YT.PlayerState.PLAYING &amp;&amp; !done) { // NEED TO ADD FILE OPERATION HERE setTimeout(stopVideo, 6000); done = true; } } function stopVideo() { player.stopVideo(); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>THanks Akansha</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload