mirror of
				https://github.com/aler9/gortsplib
				synced 2025-11-01 02:52:36 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			558 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			558 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package main
 | |
| 
 | |
| import "log"
 | |
| 
 | |
| // This example shows how to
 | |
| // 1. create a server that serves a single stream.
 | |
| // 2. create a client, read an existing stream from an external server or camera,
 | |
| //    pass the stream to the server in order to serve it.
 | |
| 
 | |
| func main() {
 | |
| 	// allocate the server.
 | |
| 	s := &server{}
 | |
| 	s.initialize()
 | |
| 
 | |
| 	// allocate the client.
 | |
| 	// give client access to the server.
 | |
| 	c := &client{server: s}
 | |
| 	c.initialize()
 | |
| 
 | |
| 	// start server and wait until a fatal error
 | |
| 	log.Printf("server is ready on %s", s.server.RTSPAddress)
 | |
| 	s.server.StartAndWait()
 | |
| }
 | 
