the userAction option of vue-video-player does not work - html

I want to remove the click event which switch player status between play and pause.
Here is my code.
<template>
<video-player
ref="videoPlayer"
:options="playerOptions"
:playsinline="false"
#play="onPlayerPlay($event)"
#pause="onPlayerPause($event)"
#ended="onPlayerEnded($event)"
#loadeddata="onPlayerLoadeddata($event)"
#waiting="onPlayerWaiting($event)"
#playing="onPlayerPlaying($event)"
#timeupdate="onPlayerTimeupdate($event)"
#canplay="onPlayerCanplay($event)"
#canplaythrough="onPlayerCanplaythrough($event)"
#ready="playerReadied"
#statechanged="playerStateChanged($event)"
/>
</template>
.........................
data() {
return {
// videojs options
playerOptions: {
autoplay: false,
muted: false,
preload: 'auto',
language: 'zh-CN',
playbackRates: [0.75, 1.0, 1.25, 1.5, 2.0], // 播放速度
aspectRatio: '16:9',
fluid: true,// 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
notSupportedMessage: '此视频暂无法播放,请刷新后再试', // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
controls: true, // 下面的控制按钮
bigPlayButton: false,
controlBar: {
playToggle: false, // 播放按钮
timeDivider: false, // 时间分割线
durationDisplay: false, // 总时间
remainingTimeDisplay: false, // 剩余播放时间
progressControl: true, // 进度条
fullscreenToggle: false // 全屏按钮
},
sources: [{
type: 'video/mp4',
// mp4
src: ''
// webm
// src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm"
}],
userActions: {
click: false // it does not work
}
}
}
},
refer to userAction
Controls how clicking on the player/tech operates. If set to false, clicking is disabled and will no longer cause the player to toggle between paused and playing. If controls are disabled with controls: false, this will not call the handler function.
If undefined or set to true, clicking is enabled and toggles the player between paused and play. To override the default click handling, set userActions.click to a function which accepts a click event (in this example it will request Full Screen, the same as a userAction.doubleClick):

Related

I am trying to assign a value from an API call to an html_editor_enhanced package for Flutter but it throws an exception

Describe the bug
I am using an html editor to write description for a product, now the thing is, it works fine when the html editor is empty (default initialisation) when I use it in my Add Product Page but when I navigate to the Edit product page and try to assign a value to html editor it throws an exception.
Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
#0 Element._debugCheckStateIsActiveForAncestorLookup. (package:flutter/src/widgets/framework.dart:4153:9)
#1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4167:6)
#2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4182:12)
#3 Theme.of (package:flutter/src/material/theme.dart:107:53)
#4 _HtmlEditorWidgetMobileState.build. (package:html_editor_enhanced/src/widgets/html_editor_widget_mobile.dart:456:34)
To reproduce
this is my onInit function for the html editor
(descriptionField is the controller for this html editor)
(descriptionResult is the variable that contains raw string, the data to be shown in this html editor)
var descriptionResult = "<p>daaaaaaaaaaaaaaaaaaaaaaaaaa</p>";
onInit: () async {
productController.descriptionField.value.insertHtml(productController.descriptionResult.value);
String tags = await productController.descriptionField.value.getText();
},
This is the complete code for the HTML Editor
HtmlEditor(
controller: productController.descriptionField.value,
htmlEditorOptions: const HtmlEditorOptions(
hint: 'Your text here...',
shouldEnsureVisible: true,
darkMode: false,
characterLimit: 3000,
),
htmlToolbarOptions: HtmlToolbarOptions(
renderSeparatorWidget: false,
toolbarPosition: ToolbarPosition.aboveEditor,
toolbarType: ToolbarType.nativeExpandable,
renderBorder: true,
buttonBorderColor: Colors.black45,
gridViewHorizontalSpacing: 0,
gridViewVerticalSpacing: 6,
initiallyExpanded: false,
dropdownBoxDecoration: BoxDecoration(border: Border.all(color: Colors.black45)),
defaultToolbarButtons: [
const StyleButtons(),
const FontButtons(
bold: true,
italic: true,
underline: false,
strikethrough: false,
clearAll: false,
subscript: false,
superscript: false,
),
const ParagraphButtons(
caseConverter: false,
decreaseIndent: false,
increaseIndent: false,
lineHeight: false,
textDirection: false,
),
const ListButtons(listStyles: false),
const InsertButtons(
link: false,
audio: false,
hr: false,
),
],
onDropdownChanged: (DropdownType type, dynamic changed, Function(dynamic)? updateSelectedItem) {
return true;
},
mediaLinkInsertInterceptor: (String url, InsertFileType type) {
return true;
},
mediaUploadInterceptor: (PlatformFile file, InsertFileType type) async {
if (type == InsertFileType.image) {
String imgUrl = await productController.postDescriptionImage(context: context, filePath: file.path!);
productController.descriptionField.value.insertNetworkImage(imgUrl);
}
return false;
},
),
otherOptions: OtherOptions(
height: 0.26.sh,
),
callbacks: Callbacks(
onBeforeCommand: (String? currentHtml) {
},
onChangeContent: (String? changed) async {
productController.descriptionResult.value = changed!;
},
onChangeCodeview: (String? changed) {
},
onChangeSelection: (EditorSettings settings) {
},
onDialogShown: () {
},
onEnter: () {
},
onFocus: () {
},
onBlur: () async {
},
onBlurCodeview: () {
},
onInit: () async {
productController.descriptionField.value.insertHtml(productController.descriptionResult.value);
String tags = await productController.descriptionField.value.getText();
},
onImageLinkInsert: (String? url) {
},
onImageUpload: (FileUpload file) async {
},
onImageUploadError: (FileUpload? file, String? base64Str, UploadError error) {
},
onKeyDown: (int? keyCode) {
},
onKeyUp: (int? keyCode) {
},
onMouseDown: () {
},
onMouseUp: () {
},
onNavigationRequestMobile: (String url) {
return NavigationActionPolicy.ALLOW;
},
onPaste: () {
},
onScroll: () {
},
),
),
Expected behavior
It does the job right but it slows down the App and it throws this exception
Screenshots
Device:
I am using a simulator and an iPhoneX for testing purposes
If you need the entire code or explanation I am all for it but I've been trying to resolve this issue for a while and I just can't figure this one out.
I have tried to use Future.delayed as well as onInit function(as described above),
I think the issue is that the value that I am trying to assign to this html editor is being assigned before the editor is initialised.
I've also raised the issue in html editor package's repository but got no response.
Kindly help me out here.

How to dynamically change settings of MediaStreamTrack

I'm trying to perform a live A/B comparison of a microphone track with and without MediaStreamTrack noiseSuppression. On Windows 10 with Firefox this works OK, but with Chrome the noiseSuppression setting fails to change when track.applyConstraints is invoked. In the following snippet, the last two logs are expected to be false, but the final one is true on Chrome. Is there a Chrome bug?
// changing audio track constraint does not change track setting in Chrome
console.log(navigator.mediaDevices.getSupportedConstraints().noiseSuppression); //true
navigator.mediaDevices.getUserMedia({ video: false, audio: { noiseSuppression: true } })
.then(stream => {
const track = stream.getTracks()[0];
console.log(track.getSettings().noiseSuppression); //true
track.applyConstraints({ noiseSuppression: false })
.then(() => {
console.log(track.getConstraints().noiseSuppression); //false
console.log(track.getSettings().noiseSuppression); //true with Chrome
})
});

Any HTML5 Audio Recorders (alongwith an Audio Player)

I have discovered Universal HTML5 players like http://www.jplayer.org/ , but none of them have a record button. Wondering if there is one, similar to the one in the image below:
You can use video.js with this plugin for recording audio/video
Here's the example:
var player = videojs("recorder",
{
controls: true,
width: 600,
height: 300,
plugins: {
wavesurfer: {
src: "live",
waveColor: "black",
progressColor: "#2E732D",
debug: true,
cursorWidth: 1,
msDisplayMax: 20,
hideScrollbar: true
},
record: {
audio: true,
video: false,
maxLength: 20,
debug: true
}
}
});
<audio id="recorder" class="video-js vjs-default-skin"></audio>
<script src="http://vjs.zencdn.net/6.2.0/video.js" defer></script>
<script src="path/to/recorder/plugin.js" defer></script>

JWplayer. Change destination source with http request

I'v got jwplayer source code from github. I want to change some scripts and built the player. So, i need to change file source from javascript in flash. In javascript i'm setting some params "host" and "flv_id":
jwplayer("mediaplayer").setup({
autostart: false,
controlbar: "none",
displayclick: "none",
smoothing: true,
stretching: "exactfit",
icons: false,
flashplayer: "/jwplayer.swf",
file: "/videos/3aae1ef41d.flv",
flv_id: "115554",
host: "<?php echo $host; ?>",
provider: "http",
startparam: "start",
height: 400,
width: 650,
events: {
onComplete: function() {
},
onPause: function(event) {
},
onError: function() {
}
}
});
In flash i have some class, which can make post-request:
var post:Post = new Post("http://"+someparameters["host"]+"/video/flv");
post.variables.id = someparameters["flv_id"];
post.Send(Go);
Go - is success callback function that returns some flvlink.
Go(link:String):void {
//link - is source, that i need to play
}
The player is playing the "/videos/3aae1ef41d.flv". But i want to play the source from Go(); I have class "Post", but i don't know the place to paste my code. Now, i haven't any changes in default source code. I don't know which file of player source code to edit. So, i need to know, how i can use my "Post" class to play video from Go function.

Sencha Touch not firing beforeshow event listener

Im new to sencha touch and going through the obligatory hair pulling and head2desk pounding.
Im trying to display a List but Im having a problem.
Im using a beforeshow event to load my json store before the list is displayed. But it's not firing the event. If any can help it is MOST appreciated.
My code is as follows: *note- this code is AS/400 centric so the /%...%/ is for that
function doList() {
var List1 = new Ext.List ({
id : List1,
renderTo : 'panel',
fullscreen: true,
showAnimation: {
type: 'slide',
duration: 250
},
cls: 'demo-list',
width: Ext.is.Phone ? undefined : 300,
height: 500,
store: ListStore,
itemTpl: '<strong>{SCEQPT}</strong>',
grouped: true,
indexBar: true,
onItemDisclosure: function(record, btn, index) {
doPopUp(record);
},
listeners: {
'beforeshow': function () {
alert('beforeshow');
var StoreList = Ext.StoreMgr.get('ListStore'
StoreList.load({
params: {
screfr: Ext.getCmp('SCREFR').getValue(),
scptyp: scptyp,
user : '/%SCUSER%/'
}
});
}
}
});
}
beforeshow listener is triggered only when you are displaying an item with show() method.
Try using the listeners
'render','beforerender' and 'afterrender'. instead.