A
A
Archakov Dennis2016-07-10 15:15:53
C++ / C#
Archakov Dennis, 2016-07-10 15:15:53

Why doesn't Opera load MP3s in?

The player works fine in all browsers , but in Opera, it gives an error:

undefined:1 Uncaught (in promise) DOMException: Failed to load because no supported source was found.

ca694c8d5f414c95b230d1a3c0c6265e.png
PS: I don't use third party plugins except for audio.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mercury13, 2016-01-18
@HackerZhenya

An iterator is an object with pointer semantics that can point to N+1 points in the object.
Since it is with pointer semantics, it has the "unary star" and −> (dereference and dereference + take field) operations. The iterator also has the ++ operation (move to the next position). If this is the so-called. "unidirectional iterator" - everything, nothing more.
There are also so-called. bidirectional iterators (there is a −− operation), and random access iterators (they can be freely added to numbers - well, just like pointers). In particular, std::list has bidirectional iterators.
Iterators have undefined behavior...
• when trying to go beyond the start or end;
• when trying to dereference if it looks at the last position (marked as "end").
Specifically about the task.
1. std::vector is preferred over std::list.
2. No need to return a string*, some container is enough (std::vector<std::string> or std::list<std::string>).
3. If the functionality and speed of istringstream is enough, the flag is in hand! I would write hardcore, from scratch. Here is my code, torn from my project, it will probably be easy to remake it into a training one.

void parseCommaList(
        const char *aStart,   // указатель на начало
        const char *aEnd,    // указатель на символ за концом
        char aComma,        // символ-разделитель
        bool aSkipEmpty,   // true, если пустые подстроки пропускать
        ProcParseCommaList aCallback,   // функция-нагрузка
        void *aData)   // этот параметр нужен, чтобы передавать какие хочешь данные в функцию-нагрузку, удаляй его смело!
{
    str::trim(aStart, aEnd);    // моя функция; пододвигает aStart вперёд и aEnd назад, убирая пробелы.
                                // Если удаление пробелов не нужно — удаляй! Если нужно — пиши сам.
    if (aStart == aEnd) return;
    const char *sstart = aStart;
    for (const char *p = aStart; p != aEnd; ++p)
    {
        if (*p != aComma) continue;
        const char *send = p;
        str::trim(sstart, send);   // то же самое, можно убрать
        if (p != sstart || !aSkipEmpty)
            aCallback(sstart, send, aData);    // замени на боевую нагрузку
        sstart = p + 1;
    }
    str::trim(sstart, aEnd);   // то же самое, можно убрать
    if (sstart != aEnd || !aSkipEmpty)
        aCallback(sstart, aEnd, aData);    // замени на боевую нагрузку
}

And, accordingly, the version for std::string.
inline void parseCommaList(
        const std::string &aIn,
        char aComma,
        bool aSkipEmpty,
        ProcParseCommaList aCallback,
        void *aData)
{
    parseCommaList(aIn.data(), aIn.data() + aIn.length(), aComma, aSkipEmpty,
            aCallback, aData);
}

O
Oleg Tsilyurik, 2016-01-17
@Olej

If not difficult, explain in Russian what an iterator is

In order not to get into the jungle (so that your head doesn’t go round at all), you can consider an iterator:
- this is “something like” a pointer to some next element of the container ...
- for which the operations ++ and -- (move ) are defined left and right ... well, if it's not a reverse iterator ;-))
- and for which you can get the value of the element of the container on which the iterator i stands, expressions: *i or i->
For the next 3 hours of googling, you enough...

A
Alexander Ananiev, 2016-01-17
@SaNNy32

For example like so stackoverflow.com/questions/236129/split-a-string-in-c

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question