Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15908

VS 2013 help in reading a direct link and displaying it on localhost

$
0
0
I encountered a problem when I programmed a program that reads live mpd links and then converts them into localhost links

-Problem that succeeded in this idea, but the channel does not work on a player when I put a broadcast link
-I offer you a picture and I hope you can help me with something:
Code:

Imports System.Net
Imports System.Threading
Imports System.Text
Imports System
Imports System.Collections.Concurrent
Imports System.IO
Imports System.Security.Cryptography.X509Certificates
Imports System.Net.Security
Imports System.Threading.Tasks
Imports bein_mena.Form1




Module localhost

    Private context As HttpListenerContext
    Public _responseThread As Thread
    Dim _httpListener As HttpListener = New HttpListener()

    Public Function startServer() As String
        Dim result As String
        Try

            Console.WriteLine("Starting server...")
            _httpListener.Prefixes.Add("http://localhost:5000/")
            _httpListener.Start()
            Console.WriteLine("Server started.")
            Dim _responseThread As Thread = New Thread(AddressOf ResponseThread)
            _responseThread.Start()
            result = "ok"
        Catch ex As Exception
            result = ex.Message
        End Try
        Return result
    End Function

 

    Public Sub ResponseThread()
        While True



            context = _httpListener.GetContext
            Dim array As Byte() = Encoding.UTF8.GetBytes("")
            Dim request As HttpListenerRequest = context.Request
            Dim response As HttpListenerResponse = context.Response

            Dim flag10 As Boolean = request.Url.ToString().Contains("ss.mpd")


            If flag10 Then
                response.ContentType = "video/mp4"
                response.StatusCode = CInt(HttpStatusCode.OK)



                array = Encoding.UTF8.GetBytes(getchannels)

           
                context.Response.Headers.Add("User-Agent", "ayer")

            End If


            Dim flag2 As Boolean = context.Request.Url.ToString().Contains("index") : If flag2 Then array = Encoding.UTF8.GetBytes(My.Resources.test)
         
         


            context.Response.OutputStream.Write(array, 0, array.Length)
            context.Response.KeepAlive = True
            context.Response.Close()

         
        End While


    End Sub






End Module


Viewing all articles
Browse latest Browse all 15908

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>