- Saved searches
- Use saved searches to filter your results more quickly
- License
- videojs/videojs-errors
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- HTML5 video error handling
- HTML
- JS
- JQuery
- AngularJS
- Решение: JavaScript error: getAudioPlayer updateCurrentpPlaying
- Елена и Марина
- Вакцинатор
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A video.js plugin that displays error messages to video viewers.
License
videojs/videojs-errors
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
A plugin that displays user-friendly messages when Video.js encounters an error.
Maintenance Status: Stable
Importing via npm/Babel/Browserify/webpack
npm install videojs-errors
Then import in your JavaScript
import videojs from 'video.js'; import 'videojs-errors';
Installing the styles will depend on your build tool. Here’s an example of including styles with brunch. See Including Module’s styles section.
Importing via script tag
The plugin automatically registers itself when you include videojs.errors.js in your page:
script src pl-s">videojs.errors.js">script>
You probably want to include the default stylesheet, too. It displays error messages as a semi-transparent overlay on top of the video element itself. It’s designed to match up fairly well with the default Video.js styles:
link href pl-s">videojs.errors.css" rel pl-s">stylesheet">
If you’re not a fan of the default styling, you can drop in your own stylesheet. The only new element to worry about is vjs-errors-dialog which is the container for the error messages.
The plugin supports multiple languages when using Video.JS v4.7.3 or greater. In order to add additional language support, add the language file after your plugin as follows:
script src pl-s">videojs.errors.js">script> script src pl-s">lang/es.js">script>
Note: A formatted example is available for Spanish under ‘lang/es.js’.
Once you’ve initialized Video.js, you can activate the errors plugin. The plugin has a set of default error messages for the standard HTML5 video errors keyed off their runtime values:
- MEDIA_ERR_ABORTED (numeric value 1 )
- MEDIA_ERR_NETWORK (numeric value 2 )
- MEDIA_ERR_DECODE (numeric value 3 )
- MEDIA_ERR_SRC_NOT_SUPPORTED (numeric value 4 )
- MEDIA_ERR_ENCRYPTED (numeric value 5 )
Additionally, some custom errors have been added as reference for future extension.
- MEDIA_ERR_UNKNOWN (value ‘unknown’ )
- PLAYER_ERR_NO_SRC (numeric value -1 )
- PLAYER_ERR_TIMEOUT (numeric value -2 )
- PLAYER_ERR_DOMAIN_RESTRICTED
- PLAYER_ERR_IP_RESTRICTED
- PLAYER_ERR_GEO_RESTRICTED
- FLASHLS_ERR_CROSS_DOMAIN
- Custom errors should reference a code value of a string.
- Two of the provided errors use negative numbers for historical reasons, but alpha-numeric/descriptive strings are less likely to cause collision issues.
If the video element emits any of those errors, the corresponding error message will be displayed. You can override and add custom error codes by supplying options to the plugin:
player.errors( errors: 3: headline: 'This is an override for the generic MEDIA_ERR_DECODE', message: 'This is a custom error message' > > >);
Or by calling player.errors.extend after initializing the plugin:
player.errors(); player.errors.extend( 3: headline: 'This is an override for the generic MEDIA_ERR_DECODE', message: 'This is a custom error message' >, foo: headline: 'My custom "foo" error', message: 'A custom "foo" error message.', type: 'PLAYER_ERR_FOO' > >);
If you define custom error messages, you’ll need to let Video.js know when to emit them yourself:
player.error(code: 'foo', dismiss: true>);
If an error is emitted that doesn’t have an associated key, a generic, catch-all message is displayed. You can override that text by supplying a message for the key unknown .
Custom Errors without a Type
As of v2.0.0, custom errors can be defined without a code. In these cases, the key provided will be used as the code. For example, the custom foo error above could be:
player.errors.extend( PLAYER_ERR_FOO: headline: 'My custom "foo" error', message: 'A custom "foo" error message.' > >);
The difference here being that one would then trigger it via:
player.error(code: 'PLAYER_ERR_FOO'>);
After the errors plugin has been initialized on a player, a getAll() method is available on the errors() plugin method. This function returns an object with all the errors the plugin currently understands:
player.errors(); var errors = player.errors.getAll(); console.log(errors['1'].type); // "MEDIA_ERR_ABORTED"
After the errors plugin has been initialized on a player, a timeout() method is available on the errors() plugin method.
A new timeout may be set by passing a timeout in milliseconds, e.g. player.errors.timeout(5 * 1000) .
Setting the timeout to Infinity or -1 will turn off this check.
If no argument is passed, the current timeout value is returned.
This functions exactly like timeout except the default value is 5 minutes.
On iPhones, default errors are not dismissible. The video element intercepts all user interaction so error message dialogs miss the tap events. If your video is busted anyways, you may not be that upset about this.
About
A video.js plugin that displays error messages to video viewers.
HTML5 video error handling
From Firefox 4 onwards, the ‘error’ event is dispatched on the element.
And you should add an error handler on the only/last source:
HTML
JS
var v = document.querySelector('video#vid'); var sources = v.querySelectorAll('source'); if (sources.length !== 0) < var lastSource = sources[sources.length-1]; lastSource.addEventListener('error', function() < alert('uh oh'); >); >
JQuery
$('video source').last().on('error', function() < alert('uh oh'); >);
AngularJS
You can create an error handling directive (or just use ng-error):
Where the error handling directive’s link function should do (copied from ng-error):
element.on('error', function(event) < scope.$apply(function() < fn(scope, ); >); >);
The link no longer contains the word «error» and I’m having trouble finding any information about this.
It’s good to know that Chrome and Firefox have different onerror callbacks. The error must therefore be mapped. Mozilla uses error.originalTarget.
Here is a sample on how to do it with pure JavaScript:
const file = 'https://samples.ffmpeg.org/MPEG-4/MPEGSolution_jurassic.mp4'; window.fetch(file, ) .then((response) => response.blob()) .then((blob) => < const url = window.URL.createObjectURL(blob); const video = document.createElement('video'); video.addEventListener('error', (event) => < let error = event; // Chrome v60 if (event.path && event.path[0]) < error = event.path[0].error; >// Firefox v55 if (event.originalTarget) < error = error.originalTarget.error; >// Here comes the error message alert(`Video error: $`); window.URL.revokeObjectURL(url); >, true); video.src = url; document.body.appendChild(video); >);
The above example maps an incoming error event into a MediaError which can be used to display an error playback message.
This is definitely a more complete answer! Solved my need for more detailed information in handling the error 🙂
Heads up for anyone using the standard structure, the errors will actually happen on the source elements as @KennyKi shared. I’m also unable to get the error information from the source errors (testing on Chrome 79.0, Safari 13.0, and Firefox 71.0)
To catch error event, you should use video.addEventListener() :
var video = document.createElement('video'); var onError = function() < // your handler>; video.addEventListener('error', onError, true); . // remove listener eventually video.removeEventListener('error', onError, true);
Note that the 3rd parameter of addEventListener (on capture) should be set to true. Error event is typically fired from descendants of video element ( tags).
Anyway, relying on video tag to fire an error event is not the best strategy to detect if video has played. This event is not fired on some android and iOS devices.
The most reliable method, I can think of, is to listen to timeupdate and ended events. If video was playing, you’ll get at least 3 timeupdate events. In the case of error, ended will be triggered more reliably than error .
Решение: JavaScript error: getAudioPlayer updateCurrentpPlaying
Ошибка JavaScript error: getAudioPlayer updateCurrentpPlaying is not a function появляется в ВК при попытке включить воспроизведение аудио или переключиться на другой плэй-лист или трек через аудиоплеер. Если у вас возникла ошибка при других обстоятельствах, напишите об этом в комментариях. Итак, к ошибке может привести несколько факторов и решений ошибки может быть несколько:
- Для начала начните с простого: вероятно один из js файлов не обновился, нажмите в вашем браузере комбинацию клавиш CTRL + F5. Сайт перезагрузится, обновив все файлы.
- Очистите данные приложений в вашем браузере. В Google chrome это делается так: перейдите в настройки, в раздел «Дополнительные». Найдите пункт «Очистить историю», вкладка «Дополнительные». Необходимо выбрать пункты «Файлы cookie и другие данные сайтов» и «Настройки контента».
- Другая причина ошибки updateCurrentpPlaying — некоторые из расширений браузера, которые работают с сайтом вконтакте, особенно с музыкой. Поробуйте временно выключить такие расширени, перезапустить браузер.
В большинстве случаев приведенные выше способы помогают в решении проблемы с ошибками getAudioPlayer updateCurrentpPlaying. Если вам помогло другое решение проблемы, просим сообщить нам об этом в комментариях.
- JavaScript
- js
- getAudioPlayer
- updateCurrentpPlaying
- is not a function
- vk
fatal error uncaugh возникает, когда в коде PHP происходит исключение (exception), вне конструкции try-catch
Елена и Марина
Здравствуйте . JavaScript error: getAudioPlayer(. ).updateCurrentPlaying is not a function. Появляется вот эта строка , и ничего кроме ленты новостей не работает .
Вакцинатор
Елена и Марина, попробуйте временно отключить все расширения в браузере, которые связаны с Вконтакте — это может быть скачивание музыки, темы оформления или что-то подобное. Как отключите — обновите страницу, должно заработать.