IAN LANG ELECTRONICS

How simple is this player? Well, I made, tested and built it in an hour on Sunday aftrenoon. The reason is that if, like me, you live in a house with a six-year-old girl and a wife in it, your 32 inch LCD widescreen is going to spend a lot of time  showing Doc McStuffins, Jake and the Neverland Pirates, Sofia the First and a wide variety of girly stuff of which you have no inkling, including Friends, which I have started to call "Six Whiny Americans".  Believe me you don't want to know about Sofia the First. Nor the Gruesome Murder Channel. And certainly not Cake Boss, which is worse than The Golden Girls.

What you do want to know about is The Big Bang Theory, Top Gear and a host of man-stuff on telly that you never get to watch because of the above and I don't know why I didn't think of doing this ages ago.

 

Here's a bit of a film showing the device in question:

Visual Basic 2010

A Really Simple Internet Television Player

Go Back

And as you probably gathered I went through a bit of a senior moment in that film: Channel 4 wasn't coming in through Netflix as I stated but showing an advert for Netflix. I blame the fact that I didn't have a large cup of tea to fall back on.

 

So, as I said, this thing is really easy to make, it's easier than eating a big cheese with crackers and ploughman's pickle. Here's what the form looks like:

formtelly

The big white square on the left is a web browser. If this is not in your toolbox under All Windows Forms then right-click on the toolbox, click on choose items and bring up this tabbed box:

choosetools

It's on .NET Framework Components as highlighted above, so make sure the checkbox to the left has a tick in it, click on OK and the web browser will appear under All Windows Forms in your VB toolbox.

Shove it on the form and give it maximum and minimum sizes of  750,500 and 20,20 and take off all the anchors in the properties window so that Anchors says none.

The four buttons are picture boxes with the logos of the channels made to be the image. The logos are 100 by 50 pixels. The code behind them is simple:

 

Public Class Form1

   Dim urlcommand As String

 

 

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

 

 

   End Sub

 

   Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

       urlcommand = "  http://www.bbc.co.uk/tv/bbcone/live"

       WebBrowser1.Navigate(urlcommand)

   End Sub

 

   Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click

       urlcommand = "http://www.itv.com/itv/"

       WebBrowser1.Navigate(urlcommand)

   End Sub

 

   Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click

       urlcommand = "http://news.sky.com/sky-news/app/liveTV/liveTv.html"

       WebBrowser1.Navigate(urlcommand)

   End Sub

 

   Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click

       urlcommand = "http://watchlive.channel4.com/C4"

       WebBrowser1.Navigate(urlcommand)

 

   End Sub

End Class

 

They're all exactly the same and so let's break one of them down into chunks.

 

       urlcommand = "http://watchlive.channel4.com/C4"

 

The above line sets the url for the live television stream

 

       WebBrowser1.Navigate(urlcommand)

 

and that line tells the web browser to navigate to the specified URL.

 

 

That's it. Two lines of code per box. All the hard work is done by the websites themselves and something very useful is done in jiff time.

 

Piece o' cake.

Ian Lang, November 2013