subhra74/xdm · error

No period found!

Error message

No period found!

What it means

A valid MPD must contain at least one <Period> child of the root MPD element. After resolving the base URL, Parse selects child::Period and throws this error when the node list is null or empty, since the rest of the parser (representations, segments) is built from periods.

Solutions

  1. Open the MPD and verify it contains at least one <Period> element directly under <MPD>.
  2. Re-download the manifest — a partial response can omit periods; compare byte size/hash with the server's.
  3. If the manifest uses namespace prefixes for Period, strip or normalize namespaces before parsing.
  4. Verify you are parsing the MPD itself, not a wrapper document or an error page that happens to have an MPD root.

Example fix

// before
var media = MpdParser.Parse(mpdUrl, null);

// after
var xml = DownloadManifest(mpdUrl);
if (!xml.Contains("<Period"))
    throw new Exception("Manifest has no Period elements; not a usable DASH VOD");
var media = MpdParser.Parse(mpdUrl, null);
Defensive patterns

Strategy: validation

Validate before calling

var body = await http.GetStringAsync(mpdUrl);
if (!body.Contains("<Period"))
    throw new Exception("MPD has no Period elements");

Try / catch

try { return MpdParser.Parse(url, null); }
catch (Exception ex) when (ex.Message == "No period found!")
{ Log.Warn("MPD without periods (truncated or namespaced manifest): {0}", url); throw; }

Prevention

When it happens

Trigger: Parsing an XML document whose root is MPD but contains no <Period> children — e.g. a minimal/invalid manifest, a manifest where periods are namespaced (parser runs with Namespaces=false, so prefixed elements like <ns:Period> won't match), or a truncated download.

Common situations: Manifest truncated by a proxy or interrupted download; unusual manifest where Period elements carry a namespace prefix so child::Period finds nothing; hand-crafted or vendor-specific MPD that omits Period; wrong XML selected due to no-namespace parsing mode.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of subhra74/xdm@1ca5a25aae (2026-09-13). Data as JSON: /api/errors/3cafb738a08c76fc. Report an issue: GitHub.

Appendix: source

Thrown at app/XDM/XDM.Core/MediaParser/Dash/MpdParser.cs:51

                throw new Exception("Missing MPD start tag: " + xmldoc.DocumentElement.Name);
            if (xmldoc.DocumentElement.Attributes["type"]?.Value == "dynamic")
                throw new Exception("Manifest type dynamic is not supported");
            if (xmldoc.DocumentElement.SelectSingleNode("descendant::ContentProtection") != null)
                throw new Exception("Encrypted manifest");

            var mediaList = new List<IList<KeyValuePair<Representation?, Representation?>>>();

            var mediaPresentationDuration =
                DashUtil.ParseXsDuration(xmldoc.DocumentElement.Attributes["mediaPresentationDuration"]?.Value ?? "0");
            var baseUrl = new Uri(playlistUrl);
            var baseUrlNodeRoot = xmldoc.DocumentElement.SelectSingleNode("child::BaseURL");
            if (baseUrlNodeRoot != null)
            {
                baseUrl = UrlResolver.Resolve(baseUrl, baseUrlNodeRoot.InnerText);
            }

            var periods = xmldoc.DocumentElement.SelectNodes("child::Period");
            if (periods == null || periods.Count < 1) throw new Exception("No period found!");
            if (periods.Count > 1)
            {
                var periodDurations = CalculatePeriodDurationsIfMissing(periods, mediaPresentationDuration);
                for (var i = 0; i < periods.Count; i++)
                {
                    var period = periods[i];
                    mediaList.Add(ParsePeriod(period, baseUrl, periodDurations[i]));
                }
            }
            else if (periods.Count == 1)
            {
                mediaList.Add(ParsePeriod(periods[0], baseUrl, mediaPresentationDuration));
            }

            return mediaList;
        }

        private static IList<KeyValuePair<Representation?, Representation?>> ParsePeriod(XmlNode period, Uri baseUrl, long mediaPresentationDuration)

View on GitHub (pinned to 1ca5a25aae)