我的 html 中有一个音频标签,其中有 src=""。当我播放音乐时,我从 javascript 更改 src 值。但是,加载页面时出现错误
无效的 URI。媒体资源加载失败。game.php 所有候选资源加载失败。媒体加载已暂停。
我知道为什么,逻辑上来源不存在。有什么方法可以告诉音频元素不要尝试从头开始加载 src 吗?
<div style="display: none;" >
<audio tabindex="0" id="audio" controls preload="auto" loop="true">
<source src="">
</audio>
</div>
Run Code Online (Sandbox Code Playgroud)
谢谢
内容
你好.
我正面临一个问题.我有一个A类,它有一个基数B(是多态的).在B类中是方法Print(),它是虚拟的.在A类中也是Print().虚拟.假设我给了一个A类型的对象(或指针),存储在B变量中
B * object = new A();
Run Code Online (Sandbox Code Playgroud)
并通过电话
object->Print();
Run Code Online (Sandbox Code Playgroud)
它调用A类中的方法,但我也希望它在B类中调用方法.从技术上讲, 我想为每个孩子调用方法,直到我到达没有孩子的班级 这可以按如下方式完成:
class A
{
public:
virtual void Print() const override
{
cout << "A" << endl;
}
};
class B : public A
{
public:
virtual void Print() const override
{
cout << "B" << endl;
A::Print(); // i do not want to call it here...
}
};
Run Code Online (Sandbox Code Playgroud)
问题是我确实不想被迫打电话给
A::Print();
Run Code Online (Sandbox Code Playgroud)
是的,你可能会问,交易是什么......我有很长的继承链.(假设继承链中有15-20个类).在游戏中,每个人都做一些小事.
让我们说
class …Run Code Online (Sandbox Code Playgroud) 我正在使用 SDL_SetTextureColorMod 函数来修改纹理。正如在这个问题的答案中看到的,该函数本身不修改纹理,只在绘制时进行颜色修改。
问题是,在调用 SDL_SetTextureColorMod 时,我无法重置效果,而且我在网上找不到任何东西。简而言之,我想为纹理添加例如变暗效果。但是,我希望能够绘制原始纹理。在应用程序中按 G 时,会应用效果。我也试过
SDL_SetTextureColorMod(texture, 1, 1, 1);
Run Code Online (Sandbox Code Playgroud)
但这并没有重置效果
代码
#include <SDL.h>
#include <SDL_image.h>
#include <iostream>
using namespace std;
int main2();
int WinMain()
{
main2();
}
SDL_Texture* LoadTexture( const string& Filename, SDL_Renderer * renderer )
{
if(renderer == nullptr)
return nullptr;
SDL_Texture* texture = IMG_LoadTexture( renderer, Filename.c_str() );
if ( texture == nullptr )
{
std::cout << __FUNCTION__ << "(...): " << "Failed to load texture " << Filename << " error …Run Code Online (Sandbox Code Playgroud)