-
May 5th, 2021, 03:07 PM
#1
Thread Starter
New Member
help in reading a direct link and displaying it on localhost
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
-
May 7th, 2021, 03:16 PM
#2
Re: help in reading a direct link and displaying it on localhost
Hi BDen, welcome to the forum. When I tried to run your code I got these errors:
Severity Code Description Project File Line Suppression State
Warning BC40056 Namespace or type specified in the Imports 'bein_mena.Form1' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. ConsoleApp1 d:\other\ConsoleApp1\ConsoleApp1\Module1.vb 10 Active
Error BC30456 'test' is not a member of 'ConsoleApp1.My.Resources'. ConsoleApp1 d:\other\ConsoleApp1\ConsoleApp1\Module1.vb 58 Active
Error BC30451 'getchannels' is not declared. It may be inaccessible due to its protection level. ConsoleApp1 d:\other\ConsoleApp1\ConsoleApp1\Module1.vb 51 Active
It looks like a few things are missing. https://www.google.com/search?q=mpd+...hrome&ie=UTF-8 - Is this what you're trying to do? I am not sure if that is something you should be asking here. That is if you're indeed trying to rip stuff.
-
May 9th, 2021, 05:42 AM
#3
Thread Starter
New Member
Re: help in reading a direct link and displaying it on localhost
Originally Posted by Peter Swinkels
Hi BDen, welcome to the forum. When I tried to run your code I got these errors:
Severity Code Description Project File Line Suppression State
Warning BC40056 Namespace or type specified in the Imports 'bein_mena.Form1' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. ConsoleApp1 d:\other\ConsoleApp1\ConsoleApp1\Module1.vb 10 Active
Error BC30456 'test' is not a member of 'ConsoleApp1.My.Resources'. ConsoleApp1 d:\other\ConsoleApp1\ConsoleApp1\Module1.vb 58 Active
Error BC30451 'getchannels' is not declared. It may be inaccessible due to its protection level. ConsoleApp1 d:\other\ConsoleApp1\ConsoleApp1\Module1.vb 51 Active
It looks like a few things are missing. https://www.google.com/search?q=mpd+...hrome&ie=UTF-8 - Is this what you're trying to do? I am not sure if that is something you should be asking here. That is if you're indeed trying to rip stuff.
Hello, thank you for your response. Nice, I tried to make an idea, but the same problem does not link. You prefer a picture to understand me more :https://i.stack.imgur.com/1C2wJ.png
I hope to help me and thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|