小编Bri*_*an 的帖子

无法使用 React 加载本地视频

我无法使用 React 加载本地视频。我已将视频放在我的文件夹“app/assets/video/concert.mp4”中。在我的 React 文件“search_bar.jsx”中,我有一个 HTML5 视频标签,我将视频来源为:

render(){ return (<video src="../../app/assets/videos/concert.mp4" controls />); }

这是我的文件结构:

  • 音乐家中心
    • 应用程序
      • 资产
        • 视频
          • 演唱会.mp4
    • 前端
      • 成分
        • search_bar.jsx

如果您加载外部视频,则视频标签有效。这是我的 webpack.config.js

 module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /(node_modules|bower_components)/,
        loader: 'babel',
        query: {
          presets: ['react', 'es2015']
        }
      },
      {
      test: /\.html$/,
      loader: 'html-loader?attrs[]=video:src'
    }, {
      test: /\.mp4$/,
      loader: 'url?limit=10000&mimetype=video/mp4'
    }
    ]
  }
Run Code Online (Sandbox Code Playgroud)

path local html5-video reactjs

5
推荐指数
1
解决办法
4596
查看次数

带字符串的动态内存分配

我的教授目前正在教授动态记忆分配的主题以及指针.我不太明白以下示例:

#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;

int main(void)
{
    int i;
    char * names[7];        // declare array of pointers to char
    char temp[16];

    // read in 7 names and dynamically allocate storage for each
    for (i = 0; i < 7; i++)
    {
        cout << "Enter a name => ";
        cin >> temp;
        names[i] = new char[strlen(temp) + 1];

        // copy the name to the newly allocated address
        strcpy(names[i],temp);
    }

    // print out the names
    for …
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
1
解决办法
1134
查看次数

标签 统计

c++ ×1

html5-video ×1

local ×1

path ×1

reactjs ×1