How does the RTMP protocol video platform EasyDSS demo platform limit the playing time of flv?

All products of TSINGSEE Green Rhinoceros Video have a demonstration platform for your reference ( how to open the "demo" mode on the EasyGBS platform ). Through the demonstration platform, you can see the layout and interface of the platform more intuitively. If you want to know more about how to use the platform, you can download the test version for testing.

However, there is a shortcoming in the use of the demonstration system that needs to be optimized. For example, in the EasyDSS official website demonstration system, if a user is playing a demonstration video and it is not closed, it will consume a lot of traffic and also put pressure on the server.

295.png

Based on this situation, our R&D personnel need to reduce the consumption of data by limiting the playback time of the video.

Check the back-end code, find the video stream setting to be played in the code and set it to empty, so that the front end will stop playing if the video stream is not available.

// 实现关闭方法
func (t *ShutDownTransport) ShutDown(d time.Duration) {
   time.AfterFunc(d, func() {
      res := t.response
      if res != nil {
         if res.Body != nil {
            res.Body.Close()
         }
      }
   })
}

After modifying the code, it will automatically stop playing after three minutes of playing, and will continue to play after clicking again.

296.png

If users who use the TSINGSEE Qingxi video platform need to turn on the demonstration system, they can find out through the article " What is the use of the demonstration system ". EasyDSS video Internet cloud service development is simple and free to combine. We provide programming language-independent RESTfulAPI interface, which can be used for secondary development and application very simply. Learn more about: EasyDSS

DSS13.png

Guess you like

Origin blog.csdn.net/EasyDSS/article/details/108647649