Copy the functions that you have proved to work, in the test stack script and paste them into the WebScraper stack script. Then, perform these steps:
init
function and the needed global variables:global gPageHTML,gMediaList on init if the platform is "iphone" or the platform is "android" then put getMedia(gPageHTML) into gMediaList if the number of lines in gMediaList = 0 then answer "There is no media in this page!" else set the itemdelimiter to "/" put empty into tMediaNames repeat with a = 1 to the number of lines in gMediaList put the last item of line a of gMediaList into line a of tMediaNames end repeat mobilePick tMediaNames,1 if the result > 0 then put the result into tMediaLine showMedia line tMediaLine of gMediaList end if end if end if end init
showMedia
function in the stack script.showMedia
function:on showMedia pMediaFile if there is an image "mediaImage" then delete image "mediaImage" set the itemdelimiter to "." switch (the last item of pMediaFile) case "png" case "gif" case "jpg" case "jpeg" new image set the name of image the number of images to "mediaImage" set the filename of image "mediaImage" to pMediaFile break case "mp4" case "m4v" case "mov" case "mp3" set the showController of the templatePlayer to true play video pMediaFile break end switch end showMedia
http://www.apple.com/
.http://www.ntonyx.com/mp3_songs.htm
is one such example.In this example, we made use of both a standard LiveCode control, the image, and also a native control, the video player. LiveCode handles the setting up of the player and with the very simple "play video videoname" syntax, we were able to invoke the native player. It was able to play both video and audio files.