Posts

Showing posts with the label Videos list in Sketchware

Create list of YouTube videos with thumbnails and titles

Image
To display a list of YouTube Videos on a page, we can follow the steps given below. 1. In VIEW area of  main.xml  add a ListView listview1 . 2. Create a Custom View custom.xml . Here add an ImageView imageview1 and TextView textview1 . 3. For listview1 select custom.xml as CustomView. 4. Add a RequestNetwork component  rn . Also add an Intent component i . 5. Create a String List idlist , a Map List videoList , a Number variable n , and a Map variable map . 6. In  onCreate  event: a. Add id of YouTube videos to idlist . Note that in video URL  https://youtu.be/dPHreMHHoGY   the video id is  dPHreMHHoGY . b. Then use a repeat block. Repeat for length of List  idlist . c. Inside repeat block, use RequestNetwork method GET for url Join https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v= and get at n of idlist and &format=json * See image above. d. After this, inside repeat block, use Number variable n increase 1. 7.