2017년 1월 14일 토요일

Watch a video from within WebViewer


I know the title is not so clear, so let me explain. I need to make available a list of videos. The list is created through a connection to a php script. The list lenght can change according to the album which the user has selected so my problem is to show the list dinamically. My goal is to how the Youtube images. Originally, I got the list directly in AppInventor but since I can't create dinamically nor images not buttons I thought to use a WebViewer and to convert the script ina page which shows within the WebViewer the list of images wrapped in an anchor which should send the user to the video:

<ul>
<?php
foreach ($videos_arr as $v)
{
?>
<li>
<a href="http://www.youtube.com/watch?v=<?php echo $v; ?>"><img src="http://img.youtube.com/vi/<?php echo $v; ?>/sddefault.jpg" width="100" height="70" /></a>
</li>
<?php
}
?>
</ul>

When I tap on a link, the video is downloaded but it never starts and the display remains black. So now I'd like to know if there is a way to launch ActivityStarter from a click/tap on a link within a WebViewer, or if there is a way to intercept this event somehow. Alternatively, I need a way to display a variable list of images...or any suggestion to solve the problem. I know that using a simple list would solve the problem efficiently but displaying a list of youtube urls absolutely meaningless wouldn't be an option.
Thank you in advance

--
See if this thread helps.

https://groups.google.com/forum/#!searchin/mitappinventortest/webview$20youtube/mitappinventortest/dNKF3yt-5fw/hT_FmXF5qwQJ


In general, it's useful to search the forum for information.

--
Thanks for trying to help but I don't agree with your response and I don't agree this thread is completed. 
I had read yet how to play a video using ActivityStarter. The problem is more complex.

1. I need to build a list with a variable number of elements
2. The list can't be a text list, it has to be a list whose elements are the images YouTube associates to each video
3. So I can't use a List component
4. But I can't use neither Image or Button components, because we can't create components at run-time
5. This is the reason because of I used a WebViewer: it allows me to display a html page with my images' list dinamically retrieved from the database
6. But now I learn that WebViewer doen't allow to view videos and I don't see nothing in Blocks which make me think that is possible to use something like onclick event

Is what I'm trying to do impossible to do with App Inventor? I'd like to know...

--
you can't play videos in the webviewer, you have to use the activity starter or the videoplayer
Thank you very much Taifun. It seems really interesting. I'll study it carefully: it looks like a very good solution. :-)

--

댓글 없음:

댓글 쓰기