Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMediaResource::dataSize() returns zero byte size for online video
Forum Updated to NodeBB v4.3 + New Features

QMediaResource::dataSize() returns zero byte size for online video

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 573 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    redstoneleo
    wrote on last edited by
    #1

    I am trying to use QMediaResource::dataSize() to get an online video byte size. However, it just returns zero - which is hard to believe in this case:

    This may be zero if the size is unknown.

    especially for the first url.

    I just want to know: (1) if it is a bug with PyQt5 or Qt5, (2) does the equivalent code in Qt5 return a nonzero result, and (3) is there any way to get the video byte size of the m3u8 url referred to?

    >>> from PyQt5.QtMultimedia import *
    >>> from PyQt5.QtCore import *
    >>> QMediaResource(QUrl('http://downdb.51voa.com/201610/will-philippines-cut-ties-with-us-and-grow-closer-to-china.mp3')).dataSize()
    0
    >>> QMediaResource(QUrl('https://www.the5fire.com/static/demos/diaosi.m3u8'),"application/vnd.apple.mpegurl").dataSize()
    0
    >>> 
    

    >>> QMediaResource(QNetworkRequest(QUrl('https://www.the5fire.com/static/demos/diaosi.m3u8')),"application/vnd.apple.mpegurl").dataSize()
    0
    >>> QMediaResource(QNetworkRequest(QUrl('https://www.the5fire.com/static/demos/diaosi.m3u8'))).dataSize()
    0
    >>> QMediaResource(QNetworkRequest(QUrl('http://downdb.51voa.com/201610/will-philippines-cut-ties-with-us-and-grow-closer-to-china.mp3'))).dataSize()
    0
    >>>
    
    raven-worxR 1 Reply Last reply
    0
    • R redstoneleo

      I am trying to use QMediaResource::dataSize() to get an online video byte size. However, it just returns zero - which is hard to believe in this case:

      This may be zero if the size is unknown.

      especially for the first url.

      I just want to know: (1) if it is a bug with PyQt5 or Qt5, (2) does the equivalent code in Qt5 return a nonzero result, and (3) is there any way to get the video byte size of the m3u8 url referred to?

      >>> from PyQt5.QtMultimedia import *
      >>> from PyQt5.QtCore import *
      >>> QMediaResource(QUrl('http://downdb.51voa.com/201610/will-philippines-cut-ties-with-us-and-grow-closer-to-china.mp3')).dataSize()
      0
      >>> QMediaResource(QUrl('https://www.the5fire.com/static/demos/diaosi.m3u8'),"application/vnd.apple.mpegurl").dataSize()
      0
      >>> 
      

      >>> QMediaResource(QNetworkRequest(QUrl('https://www.the5fire.com/static/demos/diaosi.m3u8')),"application/vnd.apple.mpegurl").dataSize()
      0
      >>> QMediaResource(QNetworkRequest(QUrl('https://www.the5fire.com/static/demos/diaosi.m3u8'))).dataSize()
      0
      >>> QMediaResource(QNetworkRequest(QUrl('http://downdb.51voa.com/201610/will-philippines-cut-ties-with-us-and-grow-closer-to-china.mp3'))).dataSize()
      0
      >>>
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @redstoneleo
      m3u is a playlist format. And playlist may contain multiple media urls.
      Also note that the byte size isn't guaranteed to be known, depending on the webserver implementation.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved