仅在智能手机上停用HTML5视频自动播放功能(Disable HTML5 video autoplay only on smartphone)
我在具有autoplay属性的网站上有一个全角视频背景。 它工作正常。
但是,在智能手机设备上,我不想显示此视频。 所以我使用css:display:none;
但是这个视频仍然是由firefox在智能手机上下载的...视频没有出现,但它仍然在缓存中下载...
我该如何解决这个问题? 是否有解决方案在小屏幕上禁用自动播放并将其保留在较大的设备上?
I have a full-width video background on a website with the autoplay attribute. It works fine.
On the smartphone device however, I don't want to display this video. So I use the css : display:none;
But the video is still downloaded by firefox on smartphone... The video does not appear but it is still downloaded in cache...
How can I fix that? Is there a solution to disable the autoplay on the little screen and keep it on the larger device?
原文:https://stackoverflow.com/questions/42862860
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
如果你想让fx:id="something"的fx:id="something"的Controller将后缀Controller附加到你的Java成员字段。 所以你必须使用: @FXML private ConfigController mConfigTabPageController; 见参考文献 。 If you want the controller of something with fx:id="something" append the suffix Controller to your Ja ...
-
永远不会调用你的secondWindow()方法。 当你调用它时,只需将引用传递给appController,你已经通过AppController appController = loader.getController();从FXML中检索了它AppController appController = loader.getController(); ,到创建新窗口的方法。 更改签名: secondWindow() 至: secondWindow(final AppController appContro ...
-
您可以使用onKeyPressed属性: onKeyPressed="#textChanged" 它调用指定控制器中的textChanged方法。 对于第二个问题:FXML的最佳参考目前是JavaFX的javadoc,因为所有属性都列在那里。 You could use the onKeyPressed property: onKeyPressed="#textChanged" which calls the textChanged method in the specified controller. ...
-
你用MainTestController mainObject =new MainTestController();创建一个新的控制器MainTestController mainObject =new MainTestController(); ,但是你需要将第一个Controller传递给第二个Controller。 将MainTestController的setter添加到SecondController并在加载FXML文件时调用它。 例如:(应该在MainTestController中) FXMLL ...
-
以下是使用slider.setLabelFormatter的示例。 import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Slider; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.util.StringConv ...
-
JavaFX:如何在同一个fxml文件中动态更改控制器?(JavaFX : How to dynamically change the controller in the same fxml file?)[2023-12-22]
添加一个功能 public void setDisplayMessageLabel(String message){ displayMassageLabel.setText(message); } 到所有Menu1DisplayControllers(Menu1,Menu2,...)。 知道你可以从你的MainContorller调用这个函数 @FXML private void handleCheckButtonAction(ActionEvent event) { if (curren ... -
从onCloseRequested的javadoc (强调我的): 当有外部请求关闭此窗口时调用。 因此,如果您自己调用close ,则不会执行处理程序。 对于不是主要阶段的Stage ,可以选择等待窗口关闭,但是: Stage.showAndWait ,所以你可以使用它来代替注册事件处理程序: stTableView.showAndWait(); // Print to console after stage is closed System.out.println("ya cerre"); From ...
-
您的控制器是否已初始化? 你设置它(在fxml / FXMLoader中)? 如果它是你的控制器加载,这应该工作。 public class DashboardController implements Initializable { @Override public void initialize(URL url, ResourceBundle rb) { myTask = new MyTask(); myTaskThread = new Thread(myTa ...